diff --git a/flake.lock b/flake.lock index 8d72be9..e1414be 100644 --- a/flake.lock +++ b/flake.lock @@ -909,6 +909,43 @@ "type": "github" } }, + "lib-net": { + "flake": false, + "locked": { + "lastModified": 1596309860, + "narHash": "sha256-izAzepR/6cDvnRfaa2ceSolMLMwqzQB5x9q62aR5J2g=", + "type": "tarball", + "url": "https://gist.github.com/duairc/5c9bb3c922e5d501a1edb9e7b3b845ba/archive/3885f7cd9ed0a746a9d675da6f265d41e9fd6704.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://gist.github.com/duairc/5c9bb3c922e5d501a1edb9e7b3b845ba/archive/3885f7cd9ed0a746a9d675da6f265d41e9fd6704.tar.gz" + } + }, + "microvm": { + "inputs": { + "flake-utils": [ + "flake-utils" + ], + "nixpkgs": [ + "nixpkgs" + ], + "spectrum": "spectrum" + }, + "locked": { + "lastModified": 1704120350, + "narHash": "sha256-s5BOPAnVc4e/4WvGDeeF3VSLAWzBUB+YW6fJb3pFbRw=", + "owner": "astro", + "repo": "microvm.nix", + "rev": "d5553b1388f2947915c4cec6249b89474046573a", + "type": "github" + }, + "original": { + "owner": "astro", + "repo": "microvm.nix", + "type": "github" + } + }, "nix-darwin": { "inputs": { "nixpkgs": [ @@ -1012,17 +1049,18 @@ "inputs": { "devshell": "devshell_3", "flake-utils": "flake-utils_4", + "lib-net": "lib-net", "nixpkgs": [ "nixpkgs" ], "pre-commit-hooks": "pre-commit-hooks_2" }, "locked": { - "lastModified": 1704474098, - "narHash": "sha256-qeSqlbSQAhvtcBsn0SUpAiGwAqVLMbxOkm6NX+NHNPI=", + "lastModified": 1704938286, + "narHash": "sha256-/uv+N2v5ixqYz7SG8R5GWOTdrNKboHEp85BR5Jdz6qE=", "owner": "oddlama", "repo": "nixos-extra-modules", - "rev": "7013e9116ddfde2e39a16b6ae8c26d869e2dbe98", + "rev": "c55f465ba1f369852ab4122a9fa42c85b4a571de", "type": "github" }, "original": { @@ -1408,6 +1446,7 @@ "home-manager": "home-manager", "impermanence": "impermanence", "lanzaboote": "lanzaboote", + "microvm": "microvm", "nix-index-database": "nix-index-database", "nixos-extra-modules": "nixos-extra-modules", "nixos-generators": "nixos-generators", @@ -1448,6 +1487,22 @@ "type": "github" } }, + "spectrum": { + "flake": false, + "locked": { + "lastModified": 1703273931, + "narHash": "sha256-CJ1Crdi5fXHkCiemovsp20/RC4vpDaZl1R6V273FecI=", + "ref": "refs/heads/main", + "rev": "97e2f3429ee61dc37664b4d096b2fec48a57b691", + "revCount": 597, + "type": "git", + "url": "https://spectrum-os.org/git/spectrum" + }, + "original": { + "type": "git", + "url": "https://spectrum-os.org/git/spectrum" + } + }, "spicetify-nix": { "inputs": { "flake-utils": "flake-utils_7", diff --git a/flake.nix b/flake.nix index 22a87cd..1243864 100644 --- a/flake.nix +++ b/flake.nix @@ -12,6 +12,11 @@ url = "github:oddlama/nixos-extra-modules"; inputs.nixpkgs.follows = "nixpkgs"; }; + microvm = { + url = "github:astro/microvm.nix"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.flake-utils.follows = "flake-utils"; + }; # to prevent multiple instances of systems systems.url = "github:nix-systems/default"; @@ -103,6 +108,7 @@ devshell, wired-notify, nixvim, + nixos-extra-modules, ... } @ inputs: let inherit (nixpkgs) lib; @@ -144,6 +150,7 @@ ++ import ./pkgs ++ [ # nixpkgs-wayland.overlay + nixos-extra-modules.overlays.default devshell.overlays.default agenix-rekey.overlays.default wired-notify.overlays.default diff --git a/hosts/desktopnix/fs.nix b/hosts/desktopnix/fs.nix index 53d679e..f2e3531 100644 --- a/hosts/desktopnix/fs.nix +++ b/hosts/desktopnix/fs.nix @@ -12,9 +12,9 @@ type = "table"; format = "gpt"; partitions = [ - (partEfiBoot "boot" "0%" "2GiB") + (partEfi "boot" "0%" "2GiB") (partSwap "swap" "2GiB" "18GiB") - (partLuksZfs "rpool" "rpool" "18GiB" "100%") + (partLuksZfs "m2-ssd" "rpool" "18GiB" "100%") ]; }; }; @@ -25,26 +25,22 @@ type = "table"; format = "gpt"; partitions = [ - (partLuksZfs "panzer" "panzer" "0%" "100%") + (partLuksZfs "sata-hdd" "panzer" "0%" "100%") ]; }; }; }; zpool = with lib.disko.zfs; { - rpool = defaultZpoolOptions // {datasets = defaultZfsDatasets;}; - panzer = - defaultZpoolOptions - // { - datasets = { - "local" = unmountable; - "local/state" = filesystem "/panzer/state"; - }; + rpool = mkZpool {datasets = impermanenceZfsDatasets;}; + panzer = mkZpool { + datasets = { + "local" = unmountable; + "local/state" = filesystem "/panzer/state"; }; + }; }; }; fileSystems."/state".neededForBoot = true; fileSystems."/persist".neededForBoot = true; fileSystems."/panzer/state".neededForBoot = true; - boot.initrd.luks.devices.enc-rpool.allowDiscards = true; - boot.initrd.luks.devices.enc-panzer.allowDiscards = true; } diff --git a/hosts/patricknix/fs.nix b/hosts/patricknix/fs.nix index ca3b62c..b88cf41 100644 --- a/hosts/patricknix/fs.nix +++ b/hosts/patricknix/fs.nix @@ -25,5 +25,4 @@ }; fileSystems."/state".neededForBoot = true; fileSystems."/persist".neededForBoot = true; - boot.initrd.luks.devices.enc-rpool.allowDiscards = true; } diff --git a/lib/default.nix b/lib/default.nix index d19828f..4288ee8 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,5 +1,4 @@ inputs: [ - (import ./disko.nix inputs) (import ./containers.nix inputs) (import ./misc.nix inputs) ] diff --git a/lib/disko.nix b/lib/disko.nix deleted file mode 100644 index b3774e1..0000000 --- a/lib/disko.nix +++ /dev/null @@ -1,85 +0,0 @@ -_inputs: _self: super: { - lib = - super.lib - // { - disko = { - gpt = { - partGrub = name: start: end: { - inherit name start end; - part-type = "primary"; - flags = ["bios_grub"]; - }; - partEfiBoot = name: start: end: { - inherit name start end; - fs-type = "fat32"; - bootable = true; - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = "/boot"; - }; - }; - partSwap = name: start: end: { - inherit name start end; - fs-type = "linux-swap"; - content = { - type = "swap"; - randomEncryption = true; - }; - }; - partLuksZfs = name: pool: start: end: { - inherit start end; - name = "enc-${name}"; - content = { - type = "luks"; - name = "enc-${name}"; - extraOpenArgs = ["--allow-discards"]; - content = { - type = "zfs"; - inherit pool; - }; - }; - }; - }; - zfs = rec { - defaultZpoolOptions = { - type = "zpool"; - rootFsOptions = { - compression = "zstd"; - acltype = "posix"; - atime = "off"; - xattr = "sa"; - dnodesize = "auto"; - mountpoint = "none"; - canmount = "off"; - devices = "off"; - }; - options.ashift = "12"; - }; - defaultZfsDatasets = { - "local" = unmountable; - "local/root" = - filesystem "/" - // { - postCreateHook = "zfs snapshot rpool/local/root@blank"; - }; - "local/nix" = filesystem "/nix"; - "local/state" = filesystem "/state"; - "safe" = unmountable; - "safe/containers" = unmountable; - "safe/persist" = filesystem "/persist"; - }; - unmountable = {type = "zfs_fs";}; - filesystem = mountpoint: { - type = "zfs_fs"; - options = { - canmount = "noauto"; - inherit mountpoint; - }; - inherit mountpoint; - # needed for initrd dependency - }; - }; - }; - }; -} diff --git a/lib/misc.nix b/lib/misc.nix index 7611683..7b262be 100644 --- a/lib/misc.nix +++ b/lib/misc.nix @@ -1,30 +1,10 @@ _inputs: _self: super: let - inherit - (super.lib) - unique - foldl' - filter - ; - - # Counts how often each element occurrs in xs. - # Elements must be strings. - countOccurrences = - foldl' - (acc: x: acc // {${x} = (acc.${x} or 0) + 1;}) - {}; - # Returns all elements in xs that occur at least twice - duplicates = xs: let - occurrences = countOccurrences xs; - in - unique (filter (x: occurrences.${x} > 1) xs); writeText = text: (super.writeText (builtins.hashString "sha256" "${text}") "${text}"); in { lib = super.lib // { inherit - countOccurrences - duplicates writeText ; }; diff --git a/modules/meta.nix b/modules/meta.nix index 124dc9e..97613e6 100644 --- a/modules/meta.nix +++ b/modules/meta.nix @@ -1,8 +1,4 @@ -{ - config, - lib, - ... -}: let +{lib, ...}: let inherit (lib) mkOption @@ -10,18 +6,9 @@ ; in { options.node = { - name = mkOption { - description = "A unique name for this node (host) in the repository. Defines the default hostname, but this can be overwritten."; - type = types.str; - }; - secretsDir = mkOption { description = "Path to the secrets directory for this node."; type = types.path; }; }; - - config = { - networking.hostName = config.node.name; - }; } diff --git a/modules/services/nextcloud.nix b/modules/services/nextcloud.nix index 30a96a4..984a42f 100644 --- a/modules/services/nextcloud.nix +++ b/modules/services/nextcloud.nix @@ -75,6 +75,7 @@ in { database.createLocally = true; phpOptions."opcache.interned_strings_buffer" = "32"; extraOptions = { + default_phone_region = "DE"; trusted_proxies = ["192.168.178.32"]; overwriteprotocol = "https"; enabledPreviewProviders = [ @@ -92,7 +93,6 @@ in { ]; }; config = { - defaultPhoneRegion = "DE"; dbtype = "pgsql"; }; };