diff --git a/configuration.nix b/configuration.nix new file mode 100644 index 0000000..3aecd59 --- /dev/null +++ b/configuration.nix @@ -0,0 +1,35 @@ +{ + modulesPath, + lib, + pkgs, + ... +} @ args: +{ + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + (modulesPath + "/profiles/qemu-guest.nix") + ./disko.nix + ]; + boot.loader.grub = { + # no need to set devices, disko will add all devices that have a EF02 partition to the list already + # devices = [ ]; + efiSupport = true; + efiInstallAsRemovable = true; + }; + services.openssh.enable = true; + + environment.systemPackages = map lib.lowPrio [ + pkgs.curl + pkgs.gitMinimal + pkgs.amneziawg-tools + pkgs.linuxKernel.packages.linux_6_15.amneziawg + ]; + + users.users.root.openssh.authorizedKeys.keys = + [ + # change this to your ssh key + "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBLB8bL44HN8mbyOVD8zJbFfQgDWwpZ/mqa+qttARivMhxRNd+JqWFLv6mDf1nENGHIiEPpQ5CdeO0RYos/P3oTg= Git@secretive.MacBook-(Den).local" + ] ++ (args.extraPublicKeys or []); # this is used for unit-testing this module and can be removed if not needed + + system.stateVersion = "24.05"; +} \ No newline at end of file diff --git a/disko.nix b/disko.nix new file mode 100644 index 0000000..4a284e8 --- /dev/null +++ b/disko.nix @@ -0,0 +1,33 @@ +{ + disko.devices = { + disk = { + my-disk = { + device = "/dev/sda"; + type = "disk"; + content = { + type = "gpt"; + partitions = { + ESP = { + type = "EF00"; + size = "500M"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ "umask=0077" ]; + }; + }; + root = { + size = "100%"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + }; + }; + }; + }; + }; + }; + }; +} \ No newline at end of file diff --git a/flake.lock b/flake.lock index 7132604..1264a68 100644 --- a/flake.lock +++ b/flake.lock @@ -17,6 +17,26 @@ "type": "github" } }, + "disko": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1750040002, + "narHash": "sha256-KrC9iOVYIn6ukpVlHbqSA4hYCZ6oDyJKrcLqv4c5v84=", + "owner": "nix-community", + "repo": "disko", + "rev": "7f1857b31522062a6a00f88cbccf86b43acceed1", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "disko", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -24,11 +44,11 @@ ] }, "locked": { - "lastModified": 1749657191, - "narHash": "sha256-QLilaHuhGxiwhgceDWESj9gFcKIdEp7+9lRqNGpN8S4=", + "lastModified": 1750127463, + "narHash": "sha256-K2xFtlD3PcKAZriOE3LaBLYmVfGQu+rIF4Jr1RFYR0Q=", "owner": "nix-community", "repo": "home-manager", - "rev": "faeab32528a9360e9577ff4082de2d35c6bbe1ce", + "rev": "28eef8722d1af18ca13e687dbf485e1c653a0402", "type": "github" }, "original": { @@ -56,11 +76,11 @@ "homebrew-cask": { "flake": false, "locked": { - "lastModified": 1749757829, - "narHash": "sha256-a3kUNkJAbx4pI8wHdkDpzECht9CAFR5TcapasVdQUis=", + "lastModified": 1750178260, + "narHash": "sha256-+KLvRCG9Andz6tdtJ2CXxMz1qwnchzZ99bQT5GByr64=", "owner": "homebrew", "repo": "homebrew-cask", - "rev": "7fd6fcd0f86d5b2a67915eec1fa48c0aa8efb8a4", + "rev": "f24446c0b7f5dde8771c02aad7de972cea4dab2c", "type": "github" }, "original": { @@ -72,11 +92,11 @@ "homebrew-core": { "flake": false, "locked": { - "lastModified": 1749751630, - "narHash": "sha256-WE3L8N7Ubyzzp8Ft5LrnxSF02YQpMpgGEst2nKhNyvY=", + "lastModified": 1750177931, + "narHash": "sha256-GnfooX24PAK1i6gSKecfNyO72UOeTKgiedM3aFU4nEc=", "owner": "homebrew", "repo": "homebrew-core", - "rev": "2caa6d1734f371ccc56f3f8724878db49b9dabe2", + "rev": "5bc583de37b4a627d0e2bdc657322ad441f133fe", "type": "github" }, "original": { @@ -92,11 +112,11 @@ ] }, "locked": { - "lastModified": 1749739639, - "narHash": "sha256-oubMGIrW/vBdX+xw47LEcxrqYqZUdLYPE8xrLDKoBE8=", + "lastModified": 1749873626, + "narHash": "sha256-1Mc/D/1RwwmDKY59f4IpDBgcQttxffm+4o0m67lQ8hc=", "owner": "nix-darwin", "repo": "nix-darwin", - "rev": "72c88d5928196159e3a0d03e67b25d8044546ca6", + "rev": "2f140d6ac8840c6089163fb43ba95220c230f22b", "type": "github" }, "original": { @@ -111,11 +131,11 @@ "brew-src": "brew-src" }, "locked": { - "lastModified": 1749519004, - "narHash": "sha256-alxmYUeHT/rKYKuHuOHDazQqCIYdbEsaEpc1uMGosfM=", + "lastModified": 1749952250, + "narHash": "sha256-V2ix0knpdJXirQ+4pjbnggjdSALTsFWGIP/NDpaQkdU=", "owner": "zhaofengli-wip", "repo": "nix-homebrew", - "rev": "e048b6646bc275341e0a854fa06168cec4c33962", + "rev": "37126f06f4890f019af3d7606ce5d30a457afcd0", "type": "github" }, "original": { @@ -124,13 +144,28 @@ "type": "github" } }, + "nixos-facter-modules": { + "locked": { + "lastModified": 1743671943, + "narHash": "sha256-7sYig0+RcrR3sOL5M+2spbpFUHyEP7cnUvCaqFOBjyU=", + "owner": "numtide", + "repo": "nixos-facter-modules", + "rev": "58ad9691670d293a15221d4a78818e0088d2e086", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "nixos-facter-modules", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1749285348, - "narHash": "sha256-frdhQvPbmDYaScPFiCnfdh3B/Vh81Uuoo0w5TkWmmjU=", + "lastModified": 1749794982, + "narHash": "sha256-Kh9K4taXbVuaLC0IL+9HcfvxsSUx8dPB5s5weJcc9pc=", "owner": "nixos", "repo": "nixpkgs", - "rev": "3e3afe5174c561dee0df6f2c2b2236990146329f", + "rev": "ee930f9755f58096ac6e8ca94a1887e0534e2d81", "type": "github" }, "original": { @@ -142,12 +177,14 @@ }, "root": { "inputs": { + "disko": "disko", "home-manager": "home-manager", "homebrew-bundle": "homebrew-bundle", "homebrew-cask": "homebrew-cask", "homebrew-core": "homebrew-core", "nix-darwin": "nix-darwin", "nix-homebrew": "nix-homebrew", + "nixos-facter-modules": "nixos-facter-modules", "nixpkgs": "nixpkgs" } } diff --git a/flake.nix b/flake.nix index 1a50b0d..c7797f7 100644 --- a/flake.nix +++ b/flake.nix @@ -4,6 +4,9 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nix-homebrew.url = "github:zhaofengli-wip/nix-homebrew"; + disko.url = "github:nix-community/disko"; + disko.inputs.nixpkgs.follows = "nixpkgs"; + nixos-facter-modules.url = "github:numtide/nixos-facter-modules"; nix-darwin = { url = "github:nix-darwin/nix-darwin/master"; inputs.nixpkgs.follows = "nixpkgs"; @@ -27,7 +30,7 @@ }; - outputs = inputs@{ self, nixpkgs, nix-darwin, nix-homebrew, homebrew-core, homebrew-cask, homebrew-bundle, home-manager }: { + outputs = inputs@{ self, nixpkgs, disko, nixos-facter-modules, nix-darwin, nix-homebrew, homebrew-core, homebrew-cask, homebrew-bundle, home-manager }: { darwinConfigurations."MacBook-Den" = nix-darwin.lib.darwinSystem { system = "aarch64-darwin"; modules = [ @@ -55,5 +58,41 @@ ]; }; darwinPackages = self.darwinConfigurations."MacBook-Den".pkgs; + + nixosConfigurations."awg" = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + disko.nixosModules.disko + ./configuration.nix + ]; + }; + nixosConfigurations.coonection = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + disko.nixosModules.disko + ./coonection.nix + ]; + }; + nixosConfigurations.metricoon = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + disko.nixosModules.disko + ./metricoon.nix + ]; + }; + nixosConfigurations.cloudcoon = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + disko.nixosModules.disko + ./cloudcoon.nix + ]; + }; + nixosConfigurations.medicoon = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + disko.nixosModules.disko + ./cloudcoon.nix + ]; + }; }; }