From 012ba5e6f460e97ae2fcb12c6eda593569987427 Mon Sep 17 00:00:00 2001 From: Lillian-Violet Date: Sun, 19 Nov 2023 23:12:21 +0100 Subject: [PATCH] a little refactoring to prepare for the vps --- flake.nix | 11 ++++ home-manager/desktop-shared.nix | 95 ++++------------------------ home-manager/program-configs/zsh.nix | 91 ++++++++++++++++++++++++++ home-manager/queen-Lillian.nix | 26 ++++++++ nixos/queen/configuration.nix | 93 +++++++++++++++++++++++++++ 5 files changed, 233 insertions(+), 83 deletions(-) create mode 100644 home-manager/program-configs/zsh.nix create mode 100644 home-manager/queen-Lillian.nix create mode 100644 nixos/queen/configuration.nix diff --git a/flake.nix b/flake.nix index 55ecf53..89d218e 100644 --- a/flake.nix +++ b/flake.nix @@ -81,5 +81,16 @@ ]; }; }; + + nixosConfigurations = { + queen = nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs outputs;}; + modules = [ + # > Our main nixos configuration file < + ./nixos/queen/configuration.nix + sops-nix.nixosModules.sops + ]; + }; + }; }; } diff --git a/home-manager/desktop-shared.nix b/home-manager/desktop-shared.nix index 7d6b34a..1501cda 100644 --- a/home-manager/desktop-shared.nix +++ b/home-manager/desktop-shared.nix @@ -6,6 +6,18 @@ pkgs, ... }: { + # You can import other home-manager modules here + imports = [ + # If you want to use modules your own flake exports (from modules/home-manager): + # outputs.homeManagerModules.example + + # Or modules exported from other flakes (such as nix-colors): + # inputs.nix-colors.homeManagerModules.default + + # You can also split up your configuration and import pieces of it here: + # ./nvim.nix + ./program-configs/zsh.nix + ]; nixpkgs = { # You can add overlays here overlays = [ @@ -106,89 +118,6 @@ ]; }; - programs.zsh = { - enable = true; - plugins = [ - { - name = "zsh-nix-shell"; - file = "nix-shell.plugin.zsh"; - src = pkgs.fetchFromGitHub { - owner = "chisui"; - repo = "zsh-nix-shell"; - rev = "v0.7.0"; - sha256 = "149zh2rm59blr2q458a5irkfh82y3dwdich60s9670kl3cl5h2m1"; - }; - } - ]; - enableAutosuggestions = true; - enableCompletion = true; - historySubstringSearch.enable = true; - syntaxHighlighting.enable = true; - zsh-abbr.enable = true; - oh-my-zsh = { - enable = true; - plugins = [ - "git" - "adb" - "battery" - "branch" - "coffee" - "colored-man-pages" - "colorize" - "command-not-found" - "common-aliases" - "compleat" - "composer" - "copypath" - "copybuffer" - "copyfile" - "cp" - "dirhistory" - "dirpersist" - "docker" - "docker-compose" - "extract" - "fancy-ctrl-z" - "fastfile" - "frontend-search" - "git-auto-fetch" - "git-escape-magic" - "git-extras" - "git-flow" - "github" - "gitignore" - "gnu-utils" - "gpg-agent" - "history" - "history-substring-search" - "isodate" - "jsontools" - "keychain" - "man" - "nanoc" - "pip" - "pipenv" - "pyenv" - "python" - "rsync" - "rvm" - "screen" - "sdk" - "sfdx" - "shell-proxy" - "sudo" - "systemadmin" - "systemd" - "themes" - "urltools" - "web-search" - "zsh-interactive-cd" - "zsh-navigation-tools" - ]; - theme = "jtriley"; - }; - }; - # Enable home-manager and git programs.home-manager.enable = true; programs.git = { diff --git a/home-manager/program-configs/zsh.nix b/home-manager/program-configs/zsh.nix new file mode 100644 index 0000000..e61cb4b --- /dev/null +++ b/home-manager/program-configs/zsh.nix @@ -0,0 +1,91 @@ +{ + inputs, + outputs, + lib, + config, + pkgs, + ... +}: { + programs.zsh = { + enable = true; + plugins = [ + { + name = "zsh-nix-shell"; + file = "nix-shell.plugin.zsh"; + src = pkgs.fetchFromGitHub { + owner = "chisui"; + repo = "zsh-nix-shell"; + rev = "v0.7.0"; + sha256 = "149zh2rm59blr2q458a5irkfh82y3dwdich60s9670kl3cl5h2m1"; + }; + } + ]; + enableAutosuggestions = true; + enableCompletion = true; + historySubstringSearch.enable = true; + syntaxHighlighting.enable = true; + zsh-abbr.enable = true; + oh-my-zsh = { + enable = true; + plugins = [ + "git" + "adb" + "battery" + "branch" + "coffee" + "colored-man-pages" + "colorize" + "command-not-found" + "common-aliases" + "compleat" + "composer" + "copypath" + "copybuffer" + "copyfile" + "cp" + "dirhistory" + "dirpersist" + "docker" + "docker-compose" + "extract" + "fancy-ctrl-z" + "fastfile" + "frontend-search" + "git-auto-fetch" + "git-escape-magic" + "git-extras" + "git-flow" + "github" + "gitignore" + "gnu-utils" + "gpg-agent" + "history" + "history-substring-search" + "isodate" + "jsontools" + "keychain" + "man" + "nanoc" + "pip" + "pipenv" + "pyenv" + "python" + "rsync" + "rvm" + "screen" + "sdk" + "sfdx" + "shell-proxy" + "sudo" + "systemadmin" + "systemd" + "themes" + "urltools" + "web-search" + "zsh-interactive-cd" + "zsh-navigation-tools" + ]; + theme = "jtriley"; + }; + }; +} diff --git a/home-manager/queen-Lillian.nix b/home-manager/queen-Lillian.nix new file mode 100644 index 0000000..7684183 --- /dev/null +++ b/home-manager/queen-Lillian.nix @@ -0,0 +1,26 @@ +# This is your home-manager configuration file +# Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix) +{ + inputs, + outputs, + lib, + config, + pkgs, + ... +}: { + # You can import other home-manager modules here + imports = [ + # If you want to use modules your own flake exports (from modules/home-manager): + # outputs.homeManagerModules.example + + # Or modules exported from other flakes (such as nix-colors): + # inputs.nix-colors.homeManagerModules.default + + # You can also split up your configuration and import pieces of it here: + # ./nvim.nix + ./program-configs/zsh.nix + ]; + + # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion + home.stateVersion = "23.11"; +} diff --git a/nixos/queen/configuration.nix b/nixos/queen/configuration.nix new file mode 100644 index 0000000..c4675df --- /dev/null +++ b/nixos/queen/configuration.nix @@ -0,0 +1,93 @@ +{ + inputs, + outputs, + lib, + config, + pkgs, + ... +}: { + nix = { + gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 7d"; + }; + # This will add each flake input as a registry + # To make nix3 commands consistent with your flake + registry = lib.mapAttrs (_: value: {flake = value;}) inputs; + + # This will additionally add your inputs to the system's legacy channels + # Making legacy nix commands consistent as well, awesome! + nixPath = lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry; + + settings = { + # Enable flakes and new 'nix' command + experimental-features = "nix-command flakes"; + # Deduplicate and optimize nix store + auto-optimise-store = true; + }; + }; + + environment.systemPackages = with pkgs; [ + age + alejandra + git-filter-repo + home-manager + noto-fonts + noto-fonts-emoji-blob-bin + noto-fonts-emoji + oh-my-zsh + rsync + wget + zsh + ]; + + # Enable networking + networking.networkmanager.enable = true; + + # Set your time zone. + time.timeZone = "Europe/Amsterdam"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "nl_NL.UTF-8"; + LC_IDENTIFICATION = "nl_NL.UTF-8"; + LC_MEASUREMENT = "nl_NL.UTF-8"; + LC_MONETARY = "nl_NL.UTF-8"; + LC_NAME = "nl_NL.UTF-8"; + LC_NUMERIC = "nl_NL.UTF-8"; + LC_PAPER = "nl_NL.UTF-8"; + LC_TELEPHONE = "nl_NL.UTF-8"; + LC_TIME = "nl_NL.UTF-8"; + }; + + programs.zsh = { + enable = true; + }; + + users.users = { + lillian = { + isNormalUser = true; + extraGroups = ["sudo" "networkmanager" "wheel" "vboxsf"]; + shell = pkgs.zsh; + }; + }; + + # Enable completion of system packages by zsh + environment.pathsToLink = ["/share/zsh"]; + + home-manager = { + extraSpecialArgs = {inherit inputs outputs;}; + users = { + # Import your home-manager configuration + lillian = import ../../home-manager/queen-Lillian.nix; + }; + }; + + networking.hostName = "queen"; + + # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion + system.stateVersion = "unstable"; +}