From 36171014c87e8b5fbd67c667bb7142dec02c8d71 Mon Sep 17 00:00:00 2001 From: Patrick Stevens Date: Thu, 24 Nov 2022 20:07:50 +0000 Subject: [PATCH] Split into multiple configs (#10) --- daily-home.nix | 98 ++++++++++++++++++++++++++++++++++++++++ darwin-configuration.nix | 2 +- flake.nix | 44 +++++++++++++++--- home.nix | 86 +++-------------------------------- server-home.nix | 2 + 5 files changed, 144 insertions(+), 88 deletions(-) create mode 100644 daily-home.nix create mode 100644 server-home.nix diff --git a/daily-home.nix b/daily-home.nix new file mode 100644 index 0000000..80f2d4a --- /dev/null +++ b/daily-home.nix @@ -0,0 +1,98 @@ +{ + nixpkgs, + username, + dotnet, + ... +}: { + imports = [./rider]; + + rider = { + enable = true; + username = username; + dotnet = dotnet; + }; + + home.packages = [ + # Broken on Apple Silicon + #nixpkgs.keepassxc + nixpkgs.rust-analyzer + nixpkgs.tmux + nixpkgs.wget + nixpkgs.youtube-dl + nixpkgs.yt-dlp + nixpkgs.cmake + nixpkgs.gnumake + nixpkgs.gcc + nixpkgs.gdb + nixpkgs.hledger + nixpkgs.hledger-web + dotnet + nixpkgs.docker + nixpkgs.jitsi-meet + #nixpkgs.handbrake + nixpkgs.ripgrep + nixpkgs.elan + nixpkgs.coreutils-prefixed + nixpkgs.shellcheck + nixpkgs.html-tidy + nixpkgs.hugo + #nixpkgs.agda + nixpkgs.pijul + nixpkgs.universal-ctags + nixpkgs.asciinema + nixpkgs.git-lfs + nixpkgs.imagemagick + nixpkgs.nixpkgs-fmt + nixpkgs.rnix-lsp + nixpkgs.grpc-tools + nixpkgs.element-desktop + ]; + + programs.vscode = { + enable = true; + package = nixpkgs.vscodium; + extensions = import ./vscode-extensions.nix {pkgs = nixpkgs;}; + userSettings = { + workbench.colorTheme = "Default High Contrast"; + "files.Exclude" = { + "**/.git" = true; + "**/.DS_Store" = true; + "**/Thumbs.db" = true; + "**/*.olean" = true; + "**/result" = true; + }; + "git.path" = "${nixpkgs.git}/bin/git"; + "update.mode" = "none"; + "docker.dockerPath" = "${nixpkgs.docker}/bin/docker"; + "lean.leanpkgPath" = "/Users/${username}/.elan/toolchains/stable/bin/leanpkg"; + "lean.executablePath" = "/Users/${username}/.elan/toolchains/stable/bin/lean"; + #"lean.executablePath" = "/Users/${username}/.elan/toolchains/lean4/bin/lean"; + "explorer.confirmDelete" = false; + "lean.memoryLimit" = 16384; + "latex-workshop.view.pdf.viewer" = "tab"; + }; + }; + + programs.zsh = { + shellAliases = { + cmake = "cmake -DCMAKE_MAKE_PROGRAM=${nixpkgs.gnumake}/bin/make -DCMAKE_AR=${nixpkgs.darwin.cctools}/bin/ar -DCMAKE_RANLIB=${nixpkgs.darwin.cctools}/bin/ranlib -DGMP_INCLUDE_DIR=${nixpkgs.gmp.dev}/include/ -DGMP_LIBRARIES=${nixpkgs.gmp}/lib/libgmp.10.dylib"; + ar = "${nixpkgs.darwin.cctools}/bin/ar"; + }; + }; + + home.file.".ssh/config".source = ./ssh.config; + + home.file.".ideavimrc".source = ./ideavimrc; + + home.file.".config/youtube-dl/config".source = ./youtube-dl.conf; + home.file.".config/yt-dlp/config".source = ./youtube-dl.conf; + programs.emacs = { + enable = true; + package = nixpkgs.emacsNativeComp; + extraPackages = epkgs: []; + extraConfig = '' + (load-file (let ((coding-system-for-read 'utf-8)) + (shell-command-to-string "agda-mode locate"))) + ''; + }; +} diff --git a/darwin-configuration.nix b/darwin-configuration.nix index 408f34a..a7f2d79 100644 --- a/darwin-configuration.nix +++ b/darwin-configuration.nix @@ -28,7 +28,7 @@ in { # Auto upgrade nix package and the daemon service. services.nix-daemon.enable = true; - nix.package = pkgs.nixFlakes; + nix.package = pkgs.nixVersions.stable; nix.gc.automatic = true; # Sandbox causes failure: https://github.com/NixOS/nix/issues/4119 diff --git a/flake.nix b/flake.nix index f7b5782..c0c1375 100644 --- a/flake.nix +++ b/flake.nix @@ -25,27 +25,57 @@ home-manager, ... } @ inputs: let - system = "aarch64-darwin"; - in let config = { #contentAddressedByDefault = true; }; in let overlays = [emacs.overlay] ++ import ./overlays.nix; - in let - pkgs = import nixpkgs {inherit system config overlays;}; in { - darwinConfigurations = { + homeConfigurations = let + system = "x86_64-linux"; + in let + pkgs = import nixpkgs {inherit system config overlays;}; + in let + args = { + nixpkgs = pkgs; + username = "patrick"; + dotnet = pkgs.dotnet-sdk_7; + }; + in { + patrick = home-manager.lib.homeManagerConfiguration { + inherit pkgs; + + modules = [ + (import ./home.nix args) + # home-manager.nixosModules.home-manager { + # home-manager.useGlobalPkgs = true; + # home-manager.useUserPackages = true; + # home-manager.users.patrick = pkgs.lib.mkMerge [(import ./server-home.nix args) (import ./home.nix args)]; + # } + ]; + }; + }; + darwinConfigurations = let + system = "aarch64-darwin"; + in let + pkgs = import nixpkgs {inherit system config overlays;}; + in { nixpkgs = pkgs; patrick = darwin.lib.darwinSystem { system = system; - modules = [ + modules = let + args = { + nixpkgs = pkgs; + username = "patrick"; + dotnet = pkgs.dotnet-sdk_7; + }; + in [ ./darwin-configuration.nix home-manager.darwinModules.home-manager { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; - home-manager.users.patrick = import ./home.nix {nixpkgs = pkgs;}; + home-manager.users.patrick = pkgs.lib.mkMerge [(import ./daily-home.nix args) (import ./home.nix args)]; } ]; }; diff --git a/home.nix b/home.nix index ab5242b..38b85d0 100644 --- a/home.nix +++ b/home.nix @@ -1,7 +1,10 @@ -{nixpkgs, ...}: let +{ + nixpkgs, + username, + dotnet, + ... +}: let username = "patrick"; -in let - dotnet = nixpkgs.dotnet-sdk_6; in { imports = [./rider]; @@ -28,65 +31,6 @@ in { # changes in each release. home.stateVersion = "22.05"; - home.packages = [ - # Broken on Apple Silicon - #nixpkgs.keepassxc - nixpkgs.rust-analyzer - nixpkgs.tmux - nixpkgs.wget - nixpkgs.youtube-dl - nixpkgs.yt-dlp - nixpkgs.cmake - nixpkgs.gnumake - nixpkgs.gcc - nixpkgs.gdb - nixpkgs.hledger - nixpkgs.hledger-web - dotnet - nixpkgs.docker - nixpkgs.jitsi-meet - #nixpkgs.handbrake - nixpkgs.ripgrep - nixpkgs.elan - nixpkgs.coreutils-prefixed - nixpkgs.shellcheck - nixpkgs.html-tidy - nixpkgs.hugo - #nixpkgs.agda - nixpkgs.pijul - nixpkgs.universal-ctags - nixpkgs.asciinema - nixpkgs.git-lfs - nixpkgs.imagemagick - nixpkgs.nixpkgs-fmt - nixpkgs.rnix-lsp - ]; - - programs.vscode = { - enable = true; - package = nixpkgs.vscodium; - extensions = import ./vscode-extensions.nix {pkgs = nixpkgs;}; - userSettings = { - workbench.colorTheme = "Default High Contrast"; - "files.Exclude" = { - "**/.git" = true; - "**/.DS_Store" = true; - "**/Thumbs.db" = true; - "**/*.olean" = true; - "**/result" = true; - }; - "git.path" = "${nixpkgs.git}/bin/git"; - "update.mode" = "none"; - "docker.dockerPath" = "${nixpkgs.docker}/bin/docker"; - "lean.leanpkgPath" = "/Users/${username}/.elan/toolchains/stable/bin/leanpkg"; - "lean.executablePath" = "/Users/${username}/.elan/toolchains/stable/bin/lean"; - #"lean.executablePath" = "/Users/${username}/.elan/toolchains/lean4/bin/lean"; - "explorer.confirmDelete" = false; - "lean.memoryLimit" = 16384; - "latex-workshop.view.pdf.viewer" = "tab"; - }; - }; - programs.tmux = { shell = "\${nixpkgs.zsh}/bin/zsh"; }; @@ -115,8 +59,6 @@ in { vim = "nvim"; view = "vim -R"; nix-upgrade = "sudo -i sh -c 'nix-channel --update && nix-env -iA nixpkgs.nix && launchctl remove org.nixos.nix-daemon && launchctl load /Library/LaunchDaemons/org.nixos.nix-daemon.plist'"; - cmake = "cmake -DCMAKE_MAKE_PROGRAM=${nixpkgs.gnumake}/bin/make -DCMAKE_AR=${nixpkgs.darwin.cctools}/bin/ar -DCMAKE_RANLIB=${nixpkgs.darwin.cctools}/bin/ranlib -DGMP_INCLUDE_DIR=${nixpkgs.gmp.dev}/include/ -DGMP_LIBRARIES=${nixpkgs.gmp}/lib/libgmp.10.dylib"; - ar = "${nixpkgs.darwin.cctools}/bin/ar"; }; }; @@ -198,20 +140,4 @@ in { programs.neovim.withPython3 = true; programs.neovim.extraConfig = builtins.readFile ./init.vim; - - home.file.".ssh/config".source = ./ssh.config; - - home.file.".ideavimrc".source = ./ideavimrc; - - home.file.".config/youtube-dl/config".source = ./youtube-dl.conf; - home.file.".config/yt-dlp/config".source = ./youtube-dl.conf; - programs.emacs = { - enable = true; - package = nixpkgs.emacsNativeComp; - extraPackages = epkgs: []; - extraConfig = '' - (load-file (let ((coding-system-for-read 'utf-8)) - (shell-command-to-string "agda-mode locate"))) - ''; - }; } diff --git a/server-home.nix b/server-home.nix new file mode 100644 index 0000000..f2e98ee --- /dev/null +++ b/server-home.nix @@ -0,0 +1,2 @@ +{nixpkgs, ...}: { +}