diff options
-rw-r--r-- | nix-personal/configuration.nix | 31 | ||||
-rw-r--r-- | nix-personal/disk-config.nix | 48 | ||||
-rw-r--r-- | nix-personal/flake.lock | 48 | ||||
-rw-r--r-- | nix-personal/flake.nix | 19 |
4 files changed, 146 insertions, 0 deletions
diff --git a/nix-personal/configuration.nix b/nix-personal/configuration.nix new file mode 100644 index 0000000..1830725 --- /dev/null +++ b/nix-personal/configuration.nix @@ -0,0 +1,31 @@ +{ + modulesPath, + config, + lib, + pkgs, + ... +}: { + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + (modulesPath + "/profiles/qemu-guest.nix") + ./disk-config.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 + ]; + + users.users.root.openssh.authorizedKeys.keys = [ + "sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIPKawhXHIFl+j/YciUzfT6AkuhLJQ9hwFU8Jl07bC7XqAAAABHNzaDo= me@aria.rip" + ]; + + system.stateVersion = "23.11"; +} diff --git a/nix-personal/disk-config.nix b/nix-personal/disk-config.nix new file mode 100644 index 0000000..5fb5fbc --- /dev/null +++ b/nix-personal/disk-config.nix @@ -0,0 +1,48 @@ +# Example to create a bios compatible gpt partition +{lib, ...}: { + disko.devices = { + disk.disk1 = { + device = lib.mkDefault "/dev/sda"; + type = "disk"; + content = { + type = "gpt"; + partitions = { + boot = { + name = "boot"; + size = "1M"; + type = "EF02"; + }; + esp = { + name = "ESP"; + size = "500M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + }; + swap = { + name = "swap"; + size = "2G"; + content = { + type = "swap"; + }; + }; + root = { + name = "root"; + size = "100%"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + mountOptions = [ + "defaults" + ]; + }; + }; + }; + }; + }; + }; +} diff --git a/nix-personal/flake.lock b/nix-personal/flake.lock new file mode 100644 index 0000000..b15b3fb --- /dev/null +++ b/nix-personal/flake.lock @@ -0,0 +1,48 @@ +{ + "nodes": { + "disko": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1701775991, + "narHash": "sha256-/51DaSTzoW+wQfj5P9EnTbSxixDFjjhfnGdMKcSp+is=", + "owner": "nix-community", + "repo": "disko", + "rev": "f84c3684900d11cf19f530070d32d55f0ed51374", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "disko", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1701539137, + "narHash": "sha256-nVO/5QYpf1GwjvtpXhyxx5M3U/WN0MwBro4Lsk+9mL0=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "933d7dc155096e7575d207be6fb7792bc9f34f6d", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "disko": "disko", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/nix-personal/flake.nix b/nix-personal/flake.nix new file mode 100644 index 0000000..946e3bb --- /dev/null +++ b/nix-personal/flake.nix @@ -0,0 +1,19 @@ +{ + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11"; + inputs.disko.url = "github:nix-community/disko"; + inputs.disko.inputs.nixpkgs.follows = "nixpkgs"; + + outputs = { + nixpkgs, + disko, + ... + }: { + nixosConfigurations.primary = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + disko.nixosModules.disko + ./configuration.nix + ]; + }; + }; +} |