From 244c66c51c13ffaceee8ecb4015f73ee11de4425 Mon Sep 17 00:00:00 2001 From: notohh Date: Sat, 22 Apr 2023 03:21:08 -0400 Subject: [PATCH] feat: init system & nix modules --- hosts/hime/default.nix | 38 +-------------------------- hosts/sutakku/default.nix | 33 ----------------------- hosts/tsuki/default.nix | 55 --------------------------------------- modules/README.md | 2 ++ modules/default.nix | 2 ++ modules/networking.nix | 4 +-- modules/nix.nix | 46 ++++++++++++++++++++++++++++++++ modules/system.nix | 34 ++++++++++++++++++++++++ 8 files changed, 87 insertions(+), 127 deletions(-) create mode 100644 modules/nix.nix create mode 100644 modules/system.nix diff --git a/hosts/hime/default.nix b/hosts/hime/default.nix index 0163fa2..fe53e52 100644 --- a/hosts/hime/default.nix +++ b/hosts/hime/default.nix @@ -20,23 +20,7 @@ networking = { hostName = "hime"; }; - - time.timeZone = "America/New_York"; - - i18n.defaultLocale = "en_US.UTF-8"; - - i18n.extraLocaleSettings = { - LC_ADDRESS = "en_US.UTF-8"; - LC_IDENTIFICATION = "en_US.UTF-8"; - LC_MEASUREMENT = "en_US.UTF-8"; - LC_MONETARY = "en_US.UTF-8"; - LC_NAME = "en_US.UTF-8"; - LC_NUMERIC = "en_US.UTF-8"; - LC_PAPER = "en_US.UTF-8"; - LC_TELEPHONE = "en_US.UTF-8"; - LC_TIME = "en_US.UTF-8"; - }; - + services.xserver = { layout = "us"; xkbVariant = ""; @@ -49,10 +33,6 @@ }; }; - services.fstrim = { - enable = true; - }; - virtualisation.docker.enable = true; users ={ defaultUserShell = pkgs.nushell; @@ -67,7 +47,6 @@ }; }; - nixpkgs.config.allowUnfree = true; environment.systemPackages = with pkgs; [ docker-compose @@ -76,19 +55,4 @@ nfs-utils ]; - nix = { - package = pkgs.nixFlakes; - extraOptions = '' - experimental-features = nix-command flakes - warn-dirty = false - ''; - settings.auto-optimise-store = true; - gc = { - automatic = true; - dates = "weekly"; - options = "--delete-older-than 7d"; - }; - }; - - system.stateVersion = "23.05"; } diff --git a/hosts/sutakku/default.nix b/hosts/sutakku/default.nix index cffc670..d8175e8 100644 --- a/hosts/sutakku/default.nix +++ b/hosts/sutakku/default.nix @@ -20,22 +20,6 @@ hostName = "sutakku"; }; - time.timeZone = "America/New_York"; - - i18n.defaultLocale = "en_US.UTF-8"; - - i18n.extraLocaleSettings = { - LC_ADDRESS = "en_US.UTF-8"; - LC_IDENTIFICATION = "en_US.UTF-8"; - LC_MEASUREMENT = "en_US.UTF-8"; - LC_MONETARY = "en_US.UTF-8"; - LC_NAME = "en_US.UTF-8"; - LC_NUMERIC = "en_US.UTF-8"; - LC_PAPER = "en_US.UTF-8"; - LC_TELEPHONE = "en_US.UTF-8"; - LC_TIME = "en_US.UTF-8"; - }; - services.xserver = { layout = "us"; xkbVariant = ""; @@ -50,7 +34,6 @@ extraGroups = [ "networkmanager" "wheel" ]; }; }; - nixpkgs.config.allowUnfree = true; environment.systemPackages = with pkgs; [ wget @@ -65,20 +48,4 @@ }; services.openssh.enable = true; - - nix = { - package = pkgs.nixFlakes; - extraOptions = '' - experimental-features = nix-command flakes - warn-dirty = false - ''; - settings.auto-optimise-store = true; - gc = { - automatic = true; - dates = "weekly"; - options = "delete-older-than 7d"; - }; - }; - - system.stateVersion = "23.05"; } diff --git a/hosts/tsuki/default.nix b/hosts/tsuki/default.nix index f898d4e..d605fa6 100755 --- a/hosts/tsuki/default.nix +++ b/hosts/tsuki/default.nix @@ -33,26 +33,7 @@ hostName = "tsuki"; }; - time.timeZone = "America/New_York"; - - i18n.defaultLocale = "en_US.UTF-8"; - - i18n.extraLocaleSettings = { - LC_ADDRESS = "en_US.UTF-8"; - LC_IDENTIFICATION = "en_US.UTF-8"; - LC_MEASUREMENT = "en_US.UTF-8"; - LC_MONETARY = "en_US.UTF-8"; - LC_NAME = "en_US.UTF-8"; - LC_NUMERIC = "en_US.UTF-8"; - LC_PAPER = "en_US.UTF-8"; - LC_TELEPHONE = "en_US.UTF-8"; - LC_TIME = "en_US.UTF-8"; - }; - services = { - fstrim = { - enable = true; - }; xserver = { enable = true; videoDrivers = [ "nvidia" ]; @@ -144,40 +125,4 @@ nodePackages_latest.yaml-language-server python310Packages.python-lsp-server ]; - - nix = { - package = pkgs.nixFlakes; - extraOptions = '' - experimental-features = nix-command flakes - warn-dirty = false - ''; - gc = { - automatic = true; - dates = "weekly"; - options = "--delete-older-than 7d"; - }; - settings = { - auto-optimise-store = true; - builders-use-substitutes = true; - substituters = [ - "https://hyprland.cachix.org" - "https://cache.nixos.org" - ]; - trusted-public-keys = [ - "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" - "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" - ]; - }; - }; - - nixpkgs.config = { - permittedInsecurePackages = [ - "qtwebkit-5.212.0-alpha4" - "electron-12.2.3" - ]; - allowUnfree = true; -}; - -system.stateVersion = "23.05"; - } diff --git a/modules/README.md b/modules/README.md index 5ea0cd6..ff32132 100644 --- a/modules/README.md +++ b/modules/README.md @@ -8,6 +8,8 @@ name | description `fonts` | font handling `greetd` | login manager `networking` | common network configuration +`nix` | common nix configuration `security` | stolen from [hlissner](https://github.com/hlissner) `swayidle` | idle manager daemon +`system.nix` | commonly shared system settings `udevd` | fixes an issue when using `nixos-rebuild`, tracked [here](https://github.com/NixOS/nixpkgs/issues/180175) \ No newline at end of file diff --git a/modules/default.nix b/modules/default.nix index 476f7e9..0bfae19 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -5,5 +5,7 @@ ./security.nix ./udevd.nix ./networking.nix + ./nix.nix + ./system.nix ]; } diff --git a/modules/networking.nix b/modules/networking.nix index 7af39a4..8afa689 100644 --- a/modules/networking.nix +++ b/modules/networking.nix @@ -3,13 +3,13 @@ }: { networking = { networkmanager.enable = true; - nameservers = [ "1.1.1.1" ]; + nameservers = [ "192.168.1.89" ]; firewall = { enable = true; }; }; environment.etc = { - "resolv.conf".text = "nameserver 1.1.1.1\n"; + "resolv.conf".text = "nameserver 192.168.1.89\n"; }; services.tailscale = { diff --git a/modules/nix.nix b/modules/nix.nix new file mode 100644 index 0000000..273c4f5 --- /dev/null +++ b/modules/nix.nix @@ -0,0 +1,46 @@ +{ + pkgs, + ... +}: { + + nixpkgs = { + config = { + allowUnfree = true; + permittedInsecurePackages = [ + "qtwebkit-5.212.0-alpha4" + "electron-12.2.3" + ]; + }; + }; + + nix = { + package = pkgs.nixFlakes; + extraOptions = '' + experimental-features = nix-command flakes + warn-dirty = false + ''; + gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 7d"; + }; + settings = { + auto-optimise-store = true; + builders-use-substitutes = true; + keep-derivations = true; + keep-outputs = true; + substituters = [ + "https://hyprland.cachix.org" + "https://cache.nixos.org" + ]; + trusted-public-keys = [ + "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" + "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" + ]; + }; + }; + + system.autoUpgrade.enable = false; + system.stateVersion = "23.05"; # no touchy + +} \ No newline at end of file diff --git a/modules/system.nix b/modules/system.nix new file mode 100644 index 0000000..e6053da --- /dev/null +++ b/modules/system.nix @@ -0,0 +1,34 @@ +{ + ... +}: { + + documentation = { + enable = true; + doc.enable = false; + man.enable = true; + dev.enable = false; + }; + + services = { + fstrim = { + enable = true; + }; + }; + + time.timeZone = "America/New_York"; + + i18n = { + defaultLocale = "en_US.UTF-8"; + extraLocaleSettings = { + LC_ADDRESS = "en_US.UTF-8"; + LC_IDENTIFICATION = "en_US.UTF-8"; + LC_MEASUREMENT = "en_US.UTF-8"; + LC_MONETARY = "en_US.UTF-8"; + LC_NAME = "en_US.UTF-8"; + LC_NUMERIC = "en_US.UTF-8"; + LC_PAPER = "en_US.UTF-8"; + LC_TELEPHONE = "en_US.UTF-8"; + LC_TIME = "en_US.UTF-8"; + }; + }; +} \ No newline at end of file