commit bc9173b7c898ddf213b81354c5586b13620c65ff Author: shinya Date: Thu May 14 21:45:04 2026 +0200 init commit diff --git a/configuration.nix b/configuration.nix new file mode 100644 index 0000000..e69de29 diff --git a/disko.nix b/disko.nix new file mode 100644 index 0000000..d548040 --- /dev/null +++ b/disko.nix @@ -0,0 +1,69 @@ +{ + fileSystems."/nix".neededForBoot = true; + + disko.devices.nodev = { + "/" = { + fsType = "tmpfs"; + mountOptions = [ + "size=25%" + "mode=755" + ]; + }; + }; + + disko.devices.disk.main = { + device = "/dev/vda"; # MAKE SURE TOO SELECT CORRECT DISK HERE + type = "disk"; + + content.type = "gpt"; + + content.partitions.boot = { + name = "boot"; + size = "1M"; + type = "EF02"; + }; + + content.partitions.esp = { + name = "ESP"; + size = "1G"; + type = "EF00"; + + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + }; + + content.partitions.swap = { + size = "4G"; + + content = { + type = "swap"; + resumeDevice = true; + }; + }; + + content.partitions.root = { + name = "root"; + size = "100%"; + + content = { + type = "btrfs"; + extraArgs = [ "-f" ]; + + subvolumes = { + "/persistent" = { + mountOptions = [ "subvol=persistent" "noatime" ]; + mountpoint = "/persistent"; + }; + + "/nix" = { + mountOptions = [ "subvol=nix" "noatime" ]; + mountpoint = "/nix"; + }; + }; + }; + }; + }; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..8bc69f2 --- /dev/null +++ b/flake.lock @@ -0,0 +1,64 @@ +{ + "nodes": { + "disko": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1777713215, + "narHash": "sha256-8GzXDOXckDWwST8TY5DbwYFjdvQLlP7K9CLSVx6iTTo=", + "owner": "nix-community", + "repo": "disko", + "rev": "63b4e7e6cf75307c1d26ac3762b886b5b0247267", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "disko", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1778443072, + "narHash": "sha256-zi7/fsqM/kFdNuED//4WOCUtezGtKKqRNORjMvfwjnA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "da5ad661ba4e5ef59ba743f0d112cbc30e474f32", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "preservation": { + "locked": { + "lastModified": 1757436102, + "narHash": "sha256-mMI9IanU+Xw+pVogD2oT0I2kTmvz2Un/Apc5+CwUpEY=", + "owner": "nix-community", + "repo": "preservation", + "rev": "93416f4614ad2dfed5b0dcf12f27e57d27a5ab11", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "preservation", + "type": "github" + } + }, + "root": { + "inputs": { + "disko": "disko", + "nixpkgs": "nixpkgs", + "preservation": "preservation" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..261e83f --- /dev/null +++ b/flake.nix @@ -0,0 +1,23 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + + disko.url = "github:nix-community/disko"; + disko.inputs.nixpkgs.follows = "nixpkgs"; + + preservation.url = "github:nix-community/preservation"; + }; + + outputs = inputs: { + nixosConfigurations.nixos = inputs.nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + inputs.disko.nixosModules.disko + inputs.preservation.nixosModules.default + ./configuration.nix + ./disko.nix + ./preservation.nix + ]; + }; + }; +} diff --git a/hardware.nix b/hardware.nix new file mode 100644 index 0000000..4471712 --- /dev/null +++ b/hardware.nix @@ -0,0 +1,14 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ + (modulesPath + "/profiles/qemu-guest.nix") + ]; + + # GENERATED! + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; diff --git a/preservation.nix b/preservation.nix new file mode 100644 index 0000000..3296295 --- /dev/null +++ b/preservation.nix @@ -0,0 +1,35 @@ +{ + preservation = { + enable = true; + + preserveAt."/persistent" = { + directories = [ + "/etc/nixos" + "/var/lib/bluetooth" + { + directory = "/var/lib/nixos"; + inInitrd = true; + } + ]; + + files = [ + { + file = "/etc/machine-id"; + inInitrd = true; + } + ]; + + # Preserve user files + # users.yurii = { + # directories = [ + # ".ssh" + # ".mozilla" + # ]; + # + # files = [ + # + # ]; + # }; + }; + }; +}