gitea->forgejo

This commit is contained in:
Cyryl Płotnicki 2023-01-24 21:36:42 +00:00
parent b2db1e0c88
commit 265563968f
3 changed files with 214 additions and 202 deletions

View file

@ -304,11 +304,11 @@
"rust-overlay": "rust-overlay_2" "rust-overlay": "rust-overlay_2"
}, },
"locked": { "locked": {
"lastModified": 1674113703, "lastModified": 1674573236,
"narHash": "sha256-au1KKVBZTyWulPxmy3CtNzJQrQWPZtTjwcfD/bDftgo=", "narHash": "sha256-VN1KG1Sh9s5IpLzVhCYAQcBITh4jmG8gl0F4wBX8lVk=",
"owner": "oxalica", "owner": "oxalica",
"repo": "nil", "repo": "nil",
"rev": "3f84b783d36d564c4380631ab48d771e2558cb81", "rev": "6e5321582ca7595455edf2a9643f83ce390d0a71",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -320,11 +320,11 @@
}, },
"nixos-hardware": { "nixos-hardware": {
"locked": { "locked": {
"lastModified": 1673803274, "lastModified": 1674550793,
"narHash": "sha256-zaJDlHFXewT4KUsidMpRcPE+REymGH1Y3Eoc3Pjv4Xs=", "narHash": "sha256-ljJlIFQZwtBbzWqWTmmw2O5BFmQf1A/DspwMOQtGXHk=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixos-hardware", "repo": "nixos-hardware",
"rev": "7bd6b87b3712e68007823e8dd5c37ee9b114fee3", "rev": "b7ac0a56029e4f9e6743b9993037a5aaafd57103",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -336,11 +336,11 @@
}, },
"nixpkgs-master": { "nixpkgs-master": {
"locked": { "locked": {
"lastModified": 1674290375, "lastModified": 1674591591,
"narHash": "sha256-yRD5bQWzu6UpDC6cybXwFizWHJCHcJTw35Ms7Q/nzU4=", "narHash": "sha256-zvzEwg6lfz7F0sBGKBt4IkY31XPPLktPGE8AIscFeAU=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "68403fe04f6c85853ddd389c9e58dd9b9c8b0a36", "rev": "73d098535c74d1d323d58a23e9bb28ffb16a673e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -352,11 +352,11 @@
}, },
"nixpkgs-nixos-unstable": { "nixpkgs-nixos-unstable": {
"locked": { "locked": {
"lastModified": 1674120619, "lastModified": 1674459583,
"narHash": "sha256-xLT1FQl7/jNPOEq5q/vmc3AExt1V9LtcjM+QY2+MUpA=", "narHash": "sha256-L0UZl/u2H3HGsrhN+by42c5kNYeKtdmJiPzIRvEVeiM=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "d7705c01ef0a39c8ef532d1033bace8845a07d35", "rev": "1b1f50645af2a70dc93eae18bfd88d330bfbcf7f",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -368,11 +368,11 @@
}, },
"nixpkgs-stable": { "nixpkgs-stable": {
"locked": { "locked": {
"lastModified": 1673957332, "lastModified": 1674407282,
"narHash": "sha256-njH7Szk1BLVWGMw7IRibgGejSlxXHj9saZHfH20gHdk=", "narHash": "sha256-2qwc8mrPINSFdWffPK+ji6nQ9aGnnZyHSItVcYDZDlk=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "b83e7f5a04a3acc8e92228b0c4bae68933d504eb", "rev": "ab1254087f4cdf4af74b552d7fc95175d9bdbb49",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -384,11 +384,11 @@
}, },
"nur": { "nur": {
"locked": { "locked": {
"lastModified": 1674290152, "lastModified": 1674589600,
"narHash": "sha256-2FPfuRPknBrg2ZBBa3latWxbbComAXLizS1ShsJHuLc=", "narHash": "sha256-MYscPro58Jc+zaNekjwEYpWqgGmMYEhUTejvI1X2RHE=",
"owner": "nix-community", "owner": "nix-community",
"repo": "NUR", "repo": "NUR",
"rev": "0eb18ae5ae3a5ff8cdef5a0c956d11cc414d757f", "rev": "67b24d408dca0b07e5281d39cabe734a0b34b5e6",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -489,11 +489,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1673752321, "lastModified": 1674546403,
"narHash": "sha256-EFfXY1ZHJq4FNaNQA9x0djtu/jiOhBbT0Xi+BT06cJw=", "narHash": "sha256-vkyNv0xzXuEnu9v52TUtRugNmQWIti8c2RhYnbLG71w=",
"owner": "Mic92", "owner": "Mic92",
"repo": "sops-nix", "repo": "sops-nix",
"rev": "e18eefd2b133a58309475298052c341c08470717", "rev": "b6ab3c61e2ca5e07d1f4eb1b67304e2670ea230c",
"type": "github" "type": "github"
}, },
"original": { "original": {

370
flake.nix
View file

@ -1,194 +1,204 @@
{ {
description = "NixOS configuration with flakes"; description = "NixOS configuration with flakes";
outputs = { self, flake-utils, flake-compat, home-manager outputs = {
, nixpkgs-nixos-unstable, nixpkgs-master, nixpkgs-stable, darwin self,
, nixos-hardware, nur, sops, nil, helix, alejandra, }@inputs: flake-utils,
let flake-compat,
mkServer = pkgs: system: hostname: home-manager,
pkgs.lib.nixosSystem { nixpkgs-nixos-unstable,
inherit system; nixpkgs-master,
modules = [ nixpkgs-stable,
(./. + "/nixos/boxes/${hostname}") darwin,
(import ./nixos/server-common.nix) nixos-hardware,
sops.nixosModules.sops nur,
]; sops,
specialArgs = { inherit inputs; }; nil,
}; helix,
mkRaspi = pkgs: hostname: alejandra,
pkgs.lib.nixosSystem { } @ inputs: let
system = "aarch64-linux"; mkServer = pkgs: system: hostname:
modules = [ (./. + "/nixos/boxes/${hostname}") ]; pkgs.lib.nixosSystem {
specialArgs = { inherit inputs; }; inherit system;
}; modules = [
mkKiosk = pkgs: system: hostname: (./. + "/nixos/boxes/${hostname}")
pkgs.lib.nixosSystem { (import ./nixos/server-common.nix)
inherit system; sops.nixosModules.sops
modules = [ ];
(./. + "/nixos/boxes/${hostname}") specialArgs = {inherit inputs system;};
(import ./nixos/common.nix)
sops.nixosModules.sops
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.cyryl = {
imports =
[ ./nixos/home-manager ./nixos/home-manager/linux.nix ];
_module.args.inputs = inputs;
_module.args.system = system;
};
}
];
specialArgs = {
inherit inputs system;
nixpkgs-nixos-stable-and-unfree = import nixpkgs-stable {
inherit system;
config = { allowUnfree = true; };
};
nixpkgs-nixos-unstable-and-unfree = import nixpkgs-nixos-unstable {
inherit system;
config = { allowUnfree = true; };
};
};
};
mkWorkstation = pkgs: system: hostname:
pkgs.lib.nixosSystem {
inherit system;
modules = [
(./. + "/nixos/boxes/${hostname}")
(import ./nixos/email-accounts.nix)
(import ./nixos/common.nix)
sops.nixosModules.sops
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.cyryl = {
imports =
[ ./nixos/home-manager ./nixos/home-manager/linux.nix ];
_module.args.inputs = inputs;
_module.args.system = system;
};
}
];
specialArgs = {
inherit inputs system;
nixpkgs-nixos-stable-and-unfree = import nixpkgs-stable {
inherit system;
config = { allowUnfree = true; };
};
nixpkgs-nixos-unstable-and-unfree = import nixpkgs-nixos-unstable {
inherit system;
config = { allowUnfree = true; };
};
};
};
mkShell = packageSet: system:
let pkgs = packageSet.legacyPackages.${system};
in pkgs.mkShell {
packages = with pkgs; [
cacert
git
git-lfs
nixpkgs-fmt
openssh
openssl
pkg-config
statix
];
};
in {
devShells = {
"x86_64-darwin".default = mkShell nixpkgs-stable "x86_64-darwin";
"x86_64-linux".default = mkShell nixpkgs-stable "x86_64-linux";
}; };
darwinConfigurations = { mkRaspi = pkgs: hostname:
"FORM3-CYRYLPLOTN" = darwin.lib.darwinSystem rec { pkgs.lib.nixosSystem {
system = "x86_64-darwin"; system = "aarch64-linux";
modules = [ modules = [(./. + "/nixos/boxes/${hostname}")];
(./. + "/nixos/boxes/form3") specialArgs = {inherit inputs;};
home-manager.darwinModules.home-manager };
{ mkKiosk = pkgs: system: hostname:
home-manager.useGlobalPkgs = true; pkgs.lib.nixosSystem {
home-manager.useUserPackages = true; inherit system;
home-manager.users.cyryl = { modules = [
imports = [ ./nixos/home-manager ]; (./. + "/nixos/boxes/${hostname}")
_module.args.inputs = inputs; (import ./nixos/common.nix)
_module.args.system = system; sops.nixosModules.sops
};
} home-manager.nixosModules.home-manager
]; {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.cyryl = {
imports = [./nixos/home-manager ./nixos/home-manager/linux.nix];
_module.args.inputs = inputs;
_module.args.system = system;
};
}
];
specialArgs = {
inherit inputs system;
nixpkgs-nixos-stable-and-unfree = import nixpkgs-stable {
inherit system;
config = {allowUnfree = true;};
};
nixpkgs-nixos-unstable-and-unfree = import nixpkgs-nixos-unstable {
inherit system;
config = {allowUnfree = true;};
};
}; };
}; };
mkWorkstation = pkgs: system: hostname:
pkgs.lib.nixosSystem {
inherit system;
modules = [
(./. + "/nixos/boxes/${hostname}")
(import ./nixos/email-accounts.nix)
(import ./nixos/common.nix)
sops.nixosModules.sops
nixosConfigurations = { home-manager.nixosModules.home-manager
foureighty = mkWorkstation nixpkgs-stable "x86_64-linux" "foureighty"; {
skinnyv = mkWorkstation nixpkgs-stable "x86_64-linux" "skinnyv"; home-manager.useGlobalPkgs = true;
thinky = mkWorkstation nixpkgs-stable "x86_64-linux" "thinky"; home-manager.useUserPackages = true;
bolty = mkServer nixpkgs-stable "x86_64-linux" "bolty"; home-manager.users.cyryl = {
vpsfree1 = mkServer nixpkgs-stable "x86_64-linux" "vpsfree1"; imports = [./nixos/home-manager ./nixos/home-manager/linux.nix];
yoga = mkKiosk nixpkgs-stable "x86_64-linux" "yoga"; _module.args.inputs = inputs;
homescreen = mkRaspi nixpkgs-stable "homescreen"; _module.args.system = system;
bootstrap = nixpkgs-stable.lib.nixosSystem rec {
system = "x86_64-linux";
modules = [ (./. + "/nixos/boxes/bootstrap") sops.nixosModules.sops ];
specialArgs = {
inherit inputs system;
nixpkgs-nixos-unstable-and-unfree = import nixpkgs-nixos-unstable {
inherit system;
config = { allowUnfree = true; };
}; };
}
];
specialArgs = {
inherit inputs system;
nixpkgs-nixos-stable-and-unfree = import nixpkgs-stable {
inherit system;
config = {allowUnfree = true;};
};
nixpkgs-nixos-unstable-and-unfree = import nixpkgs-nixos-unstable {
inherit system;
config = {allowUnfree = true;};
}; };
}; };
# nix build .#nixosConfigurations.raspiimage.config.system.build.sdImage };
# sudo dd if=result/sd-image/nixos-sd-image-21.11.20211201.a640d83-aarch64-linux.img of=/dev/sda bs=4M conv=fsync status=progress mkShell = packageSet: system: let
# make sure to update eeprom https://nixos.wiki/wiki/NixOS_on_ARM/Raspberry_Pi_4#Board-specific_installation_notes pkgs = packageSet.legacyPackages.${system};
raspiimage = nixpkgs-stable.lib.nixosSystem { in
system = "aarch64-linux"; pkgs.mkShell {
modules = [ packages = with pkgs; [
(import cacert
"${inputs.nixpkgs-nixos-unstable}/nixos/modules/installer/sd-card/sd-image-aarch64-installer.nix") git
{ git-lfs
environment.systemPackages = nixpkgs-fmt
with nixpkgs-nixos-unstable.legacyPackages."aarch64-linux"; [ openssh
neovim openssl
htop pkg-config
btop statix
atop ];
]; };
in {
networking.networkmanager.enable = false; devShells = {
hardware.enableRedistributableFirmware = true; "x86_64-darwin".default = mkShell nixpkgs-stable "x86_64-darwin";
networking.wireless.enable = true; "x86_64-linux".default = mkShell nixpkgs-stable "x86_64-linux";
};
services.openssh = { darwinConfigurations = {
enable = true; "FORM3-CYRYLPLOTN" = darwin.lib.darwinSystem rec {
permitRootLogin = system = "x86_64-darwin";
nixpkgs-stable.lib.mkForce "prohibit-password"; modules = [
passwordAuthentication = false; (./. + "/nixos/boxes/form3")
}; home-manager.darwinModules.home-manager
{
services.xserver = { home-manager.useGlobalPkgs = true;
enable = true; home-manager.useUserPackages = true;
displayManager.lightdm.enable = true; home-manager.users.cyryl = {
desktopManager.gnome.enable = true; imports = [./nixos/home-manager];
libinput.enable = true; _module.args.inputs = inputs;
}; _module.args.system = system;
};
users.extraUsers.root.openssh.authorizedKeys.keys = [ }
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEo4R+6J3h6Ix3xWpOMdU7Es1/YxFchHw0c+kcCOJxFb cyryl@foureighty" ];
];
sdImage.compressImage = false;
console.earlySetup = true;
}
];
specialArgs = { inherit inputs; };
};
}; };
}; };
nixosConfigurations = {
foureighty = mkWorkstation nixpkgs-stable "x86_64-linux" "foureighty";
skinnyv = mkWorkstation nixpkgs-stable "x86_64-linux" "skinnyv";
thinky = mkWorkstation nixpkgs-stable "x86_64-linux" "thinky";
bolty = mkServer nixpkgs-stable "x86_64-linux" "bolty";
vpsfree1 = mkServer nixpkgs-stable "x86_64-linux" "vpsfree1";
yoga = mkKiosk nixpkgs-stable "x86_64-linux" "yoga";
homescreen = mkRaspi nixpkgs-stable "homescreen";
bootstrap = nixpkgs-stable.lib.nixosSystem rec {
system = "x86_64-linux";
modules = [(./. + "/nixos/boxes/bootstrap") sops.nixosModules.sops];
specialArgs = {
inherit inputs system;
nixpkgs-nixos-unstable-and-unfree = import nixpkgs-nixos-unstable {
inherit system;
config = {allowUnfree = true;};
};
};
};
# nix build .#nixosConfigurations.raspiimage.config.system.build.sdImage
# sudo dd if=result/sd-image/nixos-sd-image-21.11.20211201.a640d83-aarch64-linux.img of=/dev/sda bs=4M conv=fsync status=progress
# make sure to update eeprom https://nixos.wiki/wiki/NixOS_on_ARM/Raspberry_Pi_4#Board-specific_installation_notes
raspiimage = nixpkgs-stable.lib.nixosSystem {
system = "aarch64-linux";
modules = [
(import
"${inputs.nixpkgs-nixos-unstable}/nixos/modules/installer/sd-card/sd-image-aarch64-installer.nix")
{
environment.systemPackages = with nixpkgs-nixos-unstable.legacyPackages."aarch64-linux"; [
neovim
htop
btop
atop
];
networking.networkmanager.enable = false;
hardware.enableRedistributableFirmware = true;
networking.wireless.enable = true;
services.openssh = {
enable = true;
permitRootLogin =
nixpkgs-stable.lib.mkForce "prohibit-password";
passwordAuthentication = false;
};
services.xserver = {
enable = true;
displayManager.lightdm.enable = true;
desktopManager.gnome.enable = true;
libinput.enable = true;
};
users.extraUsers.root.openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEo4R+6J3h6Ix3xWpOMdU7Es1/YxFchHw0c+kcCOJxFb cyryl@foureighty"
];
sdImage.compressImage = false;
console.earlySetup = true;
}
];
specialArgs = {inherit inputs;};
};
};
};
inputs = { inputs = {
nixpkgs-master = { nixpkgs-master = {
type = "github"; type = "github";

View file

@ -3,6 +3,7 @@
pkgs, pkgs,
inputs, inputs,
lib, lib,
system,
... ...
}: let }: let
httpPort = 8083; httpPort = 8083;
@ -85,7 +86,7 @@ in {
lib, lib,
... ...
}: { }: {
system.stateVersion = "22.05"; system.stateVersion = "22.11";
users = users =
users users
// { // {
@ -99,6 +100,7 @@ in {
stateDir = path; stateDir = path;
user = systemUserName; user = systemUserName;
mailerPasswordFile = mailgunSmtpPasswordPath; mailerPasswordFile = mailgunSmtpPasswordPath;
package = inputs.nixpkgs-master.legacyPackages.${system}.forgejo;
settings = { settings = {
service.DISABLE_REGISTRATION = true; service.DISABLE_REGISTRATION = true;
server = { server = {