From 6350837b3774b27f5a22f08c1601330cfe2deb7b Mon Sep 17 00:00:00 2001 From: pagedmov Date: Sun, 17 Nov 2024 21:42:06 -0500 Subject: [PATCH] started work on a new live environment nix config using impermanence --- flake.nix | 48 +++- hosts/installer/default.nix | 231 ------------------ hosts/live-env/config.nix | 41 ++++ .../disko-ext4-singledisk.nix | 0 hosts/live-env/home.nix | 44 ++++ modules/home/environment/userpkgs.nix | 1 - modules/sys/sysenv/nix.nix | 2 +- 7 files changed, 127 insertions(+), 240 deletions(-) delete mode 100755 hosts/installer/default.nix create mode 100755 hosts/live-env/config.nix rename hosts/{installer => live-env}/disko-ext4-singledisk.nix (100%) create mode 100644 hosts/live-env/home.nix diff --git a/flake.nix b/flake.nix index 1dc57a3..481fe63 100755 --- a/flake.nix +++ b/flake.nix @@ -99,10 +99,40 @@ nixvim.homeManagerModules.nixvim ]; }; + neonImpermanenceHome = let host = "neonImpermanence"; in home-manager.lib.homeManagerConfiguration { # Live Environment + pkgs = import nixpkgs { + inherit system; + config = nixpkgsConfig; + }; + extraSpecialArgs = { + inherit host self username inputs; + }; + modules = [ + ./modules/home + (import ./hosts/live-env/home.nix { username = "impermanence"; }) + nixvim.homeManagerModules.nixvim + stylix.homeManagerModules.stylix + ]; + }; + neonPersistenceHome = let host = "neonPersistence"; in home-manager.lib.homeManagerConfiguration { # Live Environment + pkgs = import nixpkgs { + inherit system; + config = nixpkgsConfig; + }; + extraSpecialArgs = { + inherit host self username inputs; + }; + modules = [ + ./modules/home + (import ./hosts/live-env/home.nix { username = "persistence"; }) + nixvim.homeManagerModules.nixvim + stylix.homeManagerModules.stylix + ]; + }; }; nixosConfigurations = { - oganesson = nixpkgs.lib.nixosSystem { + oganesson = nixpkgs.lib.nixosSystem { # Desktop specialArgs = { inherit self inputs username; host = "oganesson"; @@ -121,7 +151,7 @@ ]; }; - mercury = nixpkgs.lib.nixosSystem { + mercury = nixpkgs.lib.nixosSystem { # Laptop specialArgs = { inherit self inputs username; host = "mercury"; @@ -140,7 +170,7 @@ ]; }; - xenon = nixpkgs.lib.nixosSystem { + xenon = nixpkgs.lib.nixosSystem { # Server specialArgs = { inherit self inputs username; host = "xenon"; @@ -159,10 +189,9 @@ nur.nixosModules.nur ]; }; - - installer = nixpkgs.lib.nixosSystem { + neon = nixpkgs.lib.nixosSystem { # Live environment specialArgs = { - host = "installer"; + host = "neon"; inherit self inputs; }; inherit system; @@ -171,7 +200,12 @@ config = nixpkgsConfig; overlays = []; }; - modules = [ ./hosts/installer nixvim.nixosModules.nixvim ]; + modules = [ + ./hosts/live-env + ./modules/sys + nixvim.nixosModules.nixvim + stylix.nixosModules.stylix + ]; }; }; }; diff --git a/hosts/installer/default.nix b/hosts/installer/default.nix deleted file mode 100755 index e732b69..0000000 --- a/hosts/installer/default.nix +++ /dev/null @@ -1,231 +0,0 @@ -{ lib, pkgs, modulesPath, inputs, ... }: -let - extraFigletFonts = pkgs.fetchFromGitHub { - owner = "xero"; - repo = "figlet-fonts"; - rev = "master"; - sha256 = "sha256-dAs7N66D2Fpy4/UB5Za1r2qb1iSAJR6TMmau1asxgtY="; - }; - toilet-extrafonts = pkgs.toilet.overrideAttrs (oldAttrs: { - buildInputs = oldAttrs.buildInputs or [ ] ++ [ extraFigletFonts ]; - - installPhase = '' - make install PREFIX=$out - mkdir -p $out/share/figlet - cp -r ${extraFigletFonts}/* $out/share/figlet - ''; - }); -in { - imports = [ - "${modulesPath}/installer/cd-dvd/installation-cd-minimal.nix" - inputs.home-manager.nixosModules.home-manager - ../../modules/sys/software/nixvim - ]; - nixpkgs.hostPlatform = "x86_64-linux"; - system.stateVersion = "24.05"; - nix = { settings = { experimental-features = [ "nix-command" "flakes" ]; }; }; - - networking = { - wireless.enable = false; - networkmanager.enable = true; - hostName = "mov-nixos-installer"; - }; - - environment.systemPackages = with pkgs; [ - nix-output-monitor - nh - nvd - lolcat - curl - wget - coreutils - findutils - zip - unzip - util-linux - git - btrfs-progs - dosfstools - parted - bc - pciutils - usbutils - toilet-extrafonts - ]; - - home-manager = { - users.root = { - programs.home-manager.enable = true; - home = { - stateVersion = "24.05"; - file = { "disko.nix".source = ./disko-ext4-singledisk.nix; }; - }; - }; - }; - - services = { - openssh.enable = true; - dbus.enable = true; - }; - - programs = { - zsh = { - enable = true; - - ohMyZsh = { - enable = true; - plugins = [ "git" "fzf" ]; - }; - - enableCompletion = true; - - histFile = "$HOME/.zsh_history"; - histSize = 10000; - - autosuggestions = { - enable = true; - highlightStyle = "fg=#4C566A,underline"; - }; - - shellAliases = { - grep = "grep --color=auto"; - vi = "nvim"; - mv = "mv -v"; - cp = "cp -vr"; - ".." = "cd .."; - psg = "ps aux | grep -v grep | grep -i -e VSZ -e"; - mkdir = "mkdir -p"; - pk = "pkill -9 -f"; - svc = "sudo systemctl"; - }; - promptInit = '' - bindkey -v - type starship_zle-keymap-select >/dev/null || \ - { - eval "$(starship init zsh)" - } - ''; - setOptions = [ - "APPEND_HISTORY" - "INC_APPEND_HISTORY" - "SHARE_HISTORY" - "CORRECT" - "NO_NOMATCH" - "LIST_PACKED" - "ALWAYS_TO_END" - "GLOB_COMPLETE" - "COMPLETE_ALIASES" - "COMPLETE_IN_WORD" - "AUTO_CD" - "AUTO_CONTINUE" - "LONG_LIST_JOBS" - "HIST_VERIFY" - "SHARE_HISTORY" - "HIST_IGNORE_SPACE" - "HIST_SAVE_NO_DUPS" - "HIST_IGNORE_ALL_DUPS" - "EXTENDED_GLOB" - "TRANSIENT_RPROMPT" - "INTERACTIVE_COMMENTS" - ]; - shellInit = '' - export EDITOR="nvim" - export SUDO_EDITOR="nvim" - export VISUAL="nvim" - export LANG="en_US.UTF-8" - - unalias ls - ls() { - eza -1 --group-directories-first --icons "$@" - } - - y() { - local tmp="$(mktemp -t "yazi-cwd.XXXXXX")" - yazi "$@" --cwd-file="$tmp" - if cwd="$(command cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then - builtin cd -- "$cwd" - fi - rm -f -- "$tmp" - } - - cd() { - export SOUNDS_ENABLED=0 - eza -1 --group-directories-first --icons "$@" - builtin cd "$@" || exit - export SOUNDS_ENABLED=1 - } - if [ ! -e $HOME/.zsh_history ]; then - touch $HOME/.zsh_history - chmod 600 $HOME/.zsh_history - fi - - autoload -U compinit # completion - autoload -U terminfo # terminfo keys - zmodload -i zsh/complist # menu completion - autoload -U promptinit # prompt - - autoload -U up-line-or-beginning-search; zle -N up-line-or-beginning-search - autoload -U down-line-or-beginning-search; zle -N down-line-or-beginning-search - - unalias ls - clear - ''; - }; - starship = { - enable = true; - settings = { - add_newline = true; - right_format = "($custom)"; - - format = lib.concatStrings [ - "($username)(bold white)($cmd_duration)($character)" - "($git_branch)($git_status)($rust)($nix-shell)" - "($directory)" - "$line_break[ > ](bold #89b4fa)" - ]; - - username = { - show_always = true; - style_user = "bold white"; - format = "[$user]($style)"; - }; - directory = { - format = '' - - [$path](bold cyan)[/](bold green) ''; - style = "bold #b4befe"; - }; - - character = { - success_symbol = "[ -> ](bold green)"; - error_symbol = "[ -> ✗](bold red)"; - # error_symbol = "[ ](bold #89dceb)[ ✗](bold red)"; - }; - - cmd_duration = { - format = "[ 󰔛 $duration]($style)"; - disabled = false; - style = "bg:none fg:#f9e2af"; - show_notifications = false; - min_time_to_notify = 60000; - }; - - git_branch = { - format = '' - - on [$symbol$branch](bold purple)''; - symbol = " "; - truncation_length = 15; - style = "bold purple"; - }; - - custom.shellver = { - command = "zsh --version"; - when = ''test $SHELL = "/run/current-system/sw/bin/zsh"''; - symbol = ""; - style = "bold magenta"; - }; - }; - }; - }; -} diff --git a/hosts/live-env/config.nix b/hosts/live-env/config.nix new file mode 100755 index 0000000..75b0bf1 --- /dev/null +++ b/hosts/live-env/config.nix @@ -0,0 +1,41 @@ +{ lib, pkgs, modulesPath, inputs, ... }: + +let + userConfig = { + isNormalUser = true; + initialPassword = "1234"; + shell = pkgs.zsh; + extraGroups = [ "wheel" ]; + }; +in +{ + imports = [ ./hardware.nix ]; + + movOpts = { + sysEnv = { + issue.enable = true; + stylixConfig.enable = true; + nixSettings.enable = true; + }; + hardwareCfg = { + networkModule.enable = true; + bootLoader.enable = true; + }; + softwareCfg = { + sysPkgs.enable = true; + sysProgs.enable = true; + sysServices.enable = true; + }; + }; + + users = { + groups.persist = { }; + users = { + impermanence = userConfig; + persistence = userConfig // { + extraGroups = userConfig.extraGroups ++ [ "persist" ]; + }; + root.initialPassword = "1234"; + }; + }; +} diff --git a/hosts/installer/disko-ext4-singledisk.nix b/hosts/live-env/disko-ext4-singledisk.nix similarity index 100% rename from hosts/installer/disko-ext4-singledisk.nix rename to hosts/live-env/disko-ext4-singledisk.nix diff --git a/hosts/live-env/home.nix b/hosts/live-env/home.nix new file mode 100644 index 0000000..d175af7 --- /dev/null +++ b/hosts/live-env/home.nix @@ -0,0 +1,44 @@ +{ username, ... }: + +{ + home.username = "${username}"; + home.homeDirectory = "/home/${username}"; + home.stateVersion = "25.05"; + + programs.home-manager.enable = true; + + movOpts = { + homeFiles.enable = true; + envConfig = { + hyprlandConfig = { + enable = true; + monitorNames = [ "eDP-1" ]; + workspaceLayout = "singlemonitor"; + }; + userPkgs.enable = true; + stylixHomeConfig.enable = true; + gtkConfig.enable = true; + starshipConfig.enable = true; + swayncConfig.enable = true; + zshConfig = { + shellAliases.enable = true; + envVariables.enable = true; + shellOptions.enable = true; + extraConfig.enable = true; + }; + }; + programConfigs = { + autojumpConfig.enable = true; + btopConfig.enable = true; + ezaConfig.enable = true; + firefoxConfig.enable = true; + fuzzelConfig.enable = true; + fzfConfig.enable = true; + gitConfig.enable = true; + kittyConfig.enable = true; + yaziConfig.enable = true; + passConfig.enable = true; + batConfig.enable = true; + }; + }; +} diff --git a/modules/home/environment/userpkgs.nix b/modules/home/environment/userpkgs.nix index 56112ca..321c148 100755 --- a/modules/home/environment/userpkgs.nix +++ b/modules/home/environment/userpkgs.nix @@ -58,7 +58,6 @@ in { lolcat vesktop qbittorrent - neovide zsh zsh-syntax-highlighting zsh-history-substring-search diff --git a/modules/sys/sysenv/nix.nix b/modules/sys/sysenv/nix.nix index b1de146..98d9d8b 100755 --- a/modules/sys/sysenv/nix.nix +++ b/modules/sys/sysenv/nix.nix @@ -4,7 +4,7 @@ lib.mkEnableOption "enables my nixos settings"; }; config = lib.mkIf config.movOpts.sysEnv.nixSettings.enable { - system.stateVersion = "24.05"; + system.stateVersion = "25.05"; nix = { settings = { auto-optimise-store = true;