diff --git a/flake.lock b/flake.lock index f4dbcd2..c5d6e73 100644 --- a/flake.lock +++ b/flake.lock @@ -106,13 +106,49 @@ "type": "github" } }, + "nixlib": { + "locked": { + "lastModified": 1693701915, + "narHash": "sha256-waHPLdDYUOHSEtMKKabcKIMhlUOHPOOPQ9UyFeEoovs=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "f5af57d3ef9947a70ac86e42695231ac1ad00c25", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixos-generators": { + "inputs": { + "nixlib": "nixlib", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1696058303, + "narHash": "sha256-eNqKWpF5zG0SrgbbtljFOrRgFgRzCc4++TMFADBMLnc=", + "owner": "nix-community", + "repo": "nixos-generators", + "rev": "150f38bd1e09e20987feacb1b0d5991357532fb5", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixos-generators", + "type": "github" + } + }, "nixos-hardware": { "locked": { - "lastModified": 1695887975, - "narHash": "sha256-u3+5FR12dI305jCMb0fJNQx2qwoQ54lv1tPoEWp0hmg=", + "lastModified": 1697100850, + "narHash": "sha256-qSAzJVzNRIo+r3kBjL8TcpJctcgcHlnZyqdzpWgtg0M=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "adcfd6aa860d1d129055039696bc457af7d50d0e", + "rev": "fb6af288f6cf0f00d3af60cf9d5110433b954565", "type": "github" }, "original": { @@ -123,11 +159,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1695825837, - "narHash": "sha256-4Ne11kNRnQsmSJCRSSNkFRSnHC4Y5gPDBIQGjjPfJiU=", + "lastModified": 1696983906, + "narHash": "sha256-L7GyeErguS7Pg4h8nK0wGlcUTbfUMDu+HMf1UcyP72k=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "5cfafa12d57374f48bcc36fda3274ada276cf69e", + "rev": "bd1cde45c77891214131cbbea5b1203e485a9d51", "type": "github" }, "original": { @@ -195,6 +231,7 @@ "inputs": { "flake-programs-sqlite": "flake-programs-sqlite", "home-manager": "home-manager", + "nixos-generators": "nixos-generators", "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs", "pbsds-papers": "pbsds-papers", @@ -203,11 +240,11 @@ }, "unstable": { "locked": { - "lastModified": 1695830400, - "narHash": "sha256-gToZXQVr0G/1WriO83olnqrLSHF2Jb8BPcmCt497ro0=", + "lastModified": 1697059129, + "narHash": "sha256-9NJcFF9CEYPvHJ5ckE8kvINvI84SZZ87PvqMbH6pro0=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "8a86b98f0ba1c405358f1b71ff8b5e1d317f5db2", + "rev": "5e4c2ada4fcd54b99d56d7bd62f384511a7e2593", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 92b8568..a36c6c0 100644 --- a/flake.nix +++ b/flake.nix @@ -138,6 +138,7 @@ mkHosts = mk: with nixos-hardware.nixosModules; { # TODO: move nixos-hardware imports to the nixos configs? noximilien = mk "noximilien" "pbsds.net" "x86_64-linux" [ common-pc common-pc-ssd common-cpu-intel ]; + brumlebasse = mk "brumlebasse" "pbsds.net" "x86_64-linux" [ common-pc common-pc-ssd common-cpu-amd ]; nord = mk "nord" "pbsds.net" "x86_64-linux" [ common-pc common-pc-ssd common-cpu-intel-cpu-only common-cpu-intel-sandy-bridge common-gpu-amd common-hidpi ]; sopp = mk "sopp" "pbsds.net" "x86_64-linux" [ common-pc common-pc-ssd common-cpu-intel common-gpu-nvidia-nonprime ]; bolle = mk "bolle" "pbsds.net" "x86_64-linux" [ common-pc common-pc-ssd common-cpu-intel ]; @@ -148,11 +149,21 @@ in { inherit inputs; - packages = forAllSystems ({ pkgs, flakes, ... }: { + packages = forAllSystems ({ pkgs, flakes, ... }: let + nm = nixos-hardware.nixosModules; + in { mpv-webm = pkgs.callPackage ./pkgs/mpv-webm.nix {}; # TODO: https://github.com/NixOS/nixpkgs/pull/238659 nixos-rebuild-nom = with pkgs; writeScriptBin "nixos-rebuild" '' exec ${nixos-rebuild}/bin/nixos-rebuild "$@" |& ${nix-output-monitor}/bin/nom ''; + + # nixos-generators images + image-brumlebasse-openstack = nixos-generators.nixosGenerate { + system = "x86_64-linux"; + specialArgs = { inherit inputs flakes; }; + modules = [ (mkHosts mkModule).brumlebasse ]; + format = "openstack"; + }; }); lib = { diff --git a/hosts/brumlebasse/default.nix b/hosts/brumlebasse/default.nix new file mode 100644 index 0000000..76298d9 --- /dev/null +++ b/hosts/brumlebasse/default.nix @@ -0,0 +1,61 @@ +{ config, pkgs, lib, ... }: +{ + # Bootloader + + # gated on formatAttr which is set by nixos-generators + boot = lib.mkIf ((config.formatAttr or null) == null) { + loader.systemd-boot.enable = true; + loader.efi.canTouchEfiVariables = true; + loader.efi.efiSysMountPoint = "/boot/efi"; + }; + + imports = [ + #./hardware-configuration.nix + ../../profiles/auto-upgrade.nix + ../../profiles/upgrade-diff.nix + ../../profiles/sshd.nix + + ../../users # home-manager + ../../users/pbsds + + ../../profiles/shell/base.nix + ../../profiles/shell/archives.nix + ../../profiles/shell/nix-utils.nix + #../../profiles/shell/binfmt-emu.nix # qemu won't compile... + + #../../profiles/domeneshop-dyndns # TODO: secrets + ]; + #services.domeneshop-updater.targets = [ config.networking.fqdn ]; + + # Networking + networking.networkmanager.enable = true; + + /** / + #networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + #networking.iwd.enable = true + networking.interfaces.eno1.ipv4.addresses = [ + { address = "129.241.105.252"; prefixLength = 23; } + ]; + networking.defaultGateway.address = "192.241.104.1"; + networking.defaultGateway.interface = "eno1"; + networking.nameservers = [ + "129.241.0.200" + "129.241.0.201" + #"2001:700:300::200" + #"2001:700:300::201" + "8.8.8.8" + "1.1.1.1" + ]; + /**/ + + # TODO: remove? Move? + programs.dconf.enable = true; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It's perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "23.05"; # Did you read the comment? +} diff --git a/hosts/brumlebasse/hardware-configuration.nix b/hosts/brumlebasse/hardware-configuration.nix new file mode 100644 index 0000000..0ac171e --- /dev/null +++ b/hosts/brumlebasse/hardware-configuration.nix @@ -0,0 +1,38 @@ +# 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 + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/a489fe59-1f67-46a0-8c7a-91adbac021e0"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/2663-B2BA"; + fsType = "vfat"; + }; + + swapDevices = [ ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp3s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/profiles/upgrade-diff.nix b/profiles/upgrade-diff.nix index 5294321..827b309 100644 --- a/profiles/upgrade-diff.nix +++ b/profiles/upgrade-diff.nix @@ -1,9 +1,10 @@ -{ pkgs, ... }: +{ config, lib, pkgs, ... }: { # nvd: https://discourse.nixos.org/t/nvd-simple-nix-nixos-version-diff-tool/12397 # module from https://github.com/luishfonseca/dotfiles/blob/ab7625ec406b48493eda701911ad1cd017ce5bc1/modules/upgrade-diff.nix - system.activationScripts.diff = { + # gated on formatAttr which is set by nixos-generators + system.activationScripts.diff = lib.mkIf ((config.formatAttr or null) == null) { supportsDryActivation = true; text = '' ${pkgs.nvd}/bin/nvd --nix-bin-dir=${pkgs.nix}/bin diff /run/current-system "$systemConfig"