refactor(flake)!: deduplicate code in configurations flake module

Pass around `perSystem`'s `pkgs` instances to the system configurations
Some more refactoring in `configurations`' `mkHost` functions
Also start using `home-manager`'s `useGlobalPkgs` option
Also use `mkShellNoCC` for default `devShell`
Also `nix flake update`
This commit is contained in:
reo101 2024-07-20 14:30:25 +03:00
parent eeae48b5d8
commit e3b1539b41
Signed by: reo101
GPG key ID: 675AA7EF13964ACB
19 changed files with 183 additions and 246 deletions

View file

@ -14,32 +14,6 @@
./nvim.nix
];
nixpkgs = {
# You can add overlays here
overlays = [
# If you want to use overlays your own flake exports (from overlays dir):
# outputs.overlays.modifications
# outputs.overlays.additions
# Or overlays exported from other flakes:
# neovim-nightly-overlay.overlays.default
# Or define it inline, for example:
# (final: prev: {
# hi = final.hello.overrideAttrs (oldAttrs: {
# patches = [ ./change-hello-to-hi.patch ];
# });
# })
];
# Configure your nixpkgs instance
config = {
# Disable if you don't want unfree packages
allowUnfree = true;
# Workaround for https://github.com/nix-community/home-manager/issues/2942
allowUnfreePredicate = (_: true);
};
};
# TODO: Set your username
home = {
username = "your-username";

View file

@ -8,10 +8,21 @@
# Auto upgrade nix package and the daemon service.
services.nix-daemon.enable = true;
nix = {
nix = let
flakeInputs = lib.filterAttrs (lib.const (lib.isType "flake")) inputs;
in {
# Ensure we can work with flakes
# NOTE: run `sudo -i nix-env --uninstall nix` to uninstall the global `nix`
package = pkgs.nixVersions.monitored.latest;
# This will add each flake input as a registry
# To make nix3 commands consistent with your flake
registry = lib.mapAttrs (_: value: { flake = value; }) flakeInputs;
# 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}=flake:${key}") flakeInputs;
# extraOptions = ''
# # Enable flakes and new 'nix' command
# experimental-features = nix-command flakes
@ -24,15 +35,6 @@
# keep-derivations = true
# '';
# registry.nixpkgs.flake = inputs.nixpkgs;
# registry =
# lib.mapAttrs'
# (name: value:
# {
# name = name;
# value = { flake = value; };
# })
# inputs;
settings = {
# Enable flakes and new 'nix' command
@ -89,8 +91,7 @@
programs.zsh.enable = true; # default shell on catalina
# Fonts
fonts.fontDir.enable = true;
fonts.fonts = with pkgs; [
fonts.packages = with pkgs; [
(nerdfonts.override { fonts = [ "FiraCode" ]; })
];

View file

@ -7,14 +7,6 @@
stateVersion = "23.05";
};
# Add custom overlays
nixpkgs = {
overlays = builtins.attrValues outputs.overlays ++ [
inputs.neovim-nightly-overlay.overlays.default
inputs.zig-overlay.overlays.default
];
};
# Set env vars
home.sessionVariables = {
EDITOR = "nvim";
@ -40,18 +32,33 @@
# Neovim
neovim
# (neovim.overrideAttrs (oldAttrs: {
# lua = luajitcoroutineclone;
# }))
(pkgs.writeShellScriptBin "lua" "exec -a $0 ${luajitPackages.nlua}/bin/nlua $@")
# luajitPackages.nlua
fennel
fennel-language-server
# fennel-language-server
fennel-ls
git
gh
# (gnumake.override { guileSupport = true; })
gnumake
# # Emacs
# (emacs-unstable.override {
# withGTK3 = true;
# :
# })
# Dhall
dhall
# dhall
# dhall-lsp-server
# Circom
circom
circom-lsp
# circom
# circom-lsp
# Nix
nil
@ -61,6 +68,9 @@
# Mail
# himalaya
# Java
graalvm-ce
# SSH and GPG
openssh
gnupg
@ -99,8 +109,27 @@
wezterm = {
enable = true;
};
spotify = {
enable = false;
};
};
# programs.git = {
# enable = true;
# userName = "reo101";
# # userEmail = "pavel.atanasov@limechain.tech";
# userEmail = "pavel.atanasov2001@gmail.com";
# signing = {
# signByDefault = true;
# key = "675AA7EF13964ACB";
# };
# # init.defaultBranch = "master";
# lfs = {
# enable = true;
# };
# };
home.file.".gnupg/gpg-agent.conf" = {
text = ''
allow-preset-passphrase

View file

@ -23,14 +23,6 @@
inputs.zls-overlay.packages.x86_64-darwin.default
];
nixpkgs = {
overlays = [
inputs.zig-overlay.overlays.default
];
config.allowUnfree = true;
};
programs.git = {
enable = true;
userName = "apavel";

View file

@ -7,14 +7,6 @@
stateVersion = "23.05";
};
# Add custom overlays
nixpkgs = {
overlays = [
inputs.neovim-nightly-overlay.overlays.default
inputs.zig-overlay.overlays.default
];
};
# Set env vars
home.sessionVariables = {
EDITOR = "nvim";

View file

@ -10,15 +10,6 @@
stateVersion = "23.05";
};
# Add custom overlays
nixpkgs = {
overlays = [
inputs.neovim-nightly-overlay.overlays.default
inputs.zig-overlay.overlays.default
# inputs.zls-overlay.???
];
};
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;

View file

@ -94,12 +94,6 @@
};
};
nixpkgs = {
config = {
allowUnfree = true;
};
};
### Fonts
fonts.fontconfig.enable = true;

View file

@ -5,16 +5,6 @@
inputs.wired.homeManagerModules.default
];
nixpkgs = {
overlays = builtins.attrValues outputs.overlays ++ [
inputs.neovim-nightly-overlay.overlays.default
inputs.zig-overlay.overlays.default
inputs.wired.overlays.default
];
config.allowUnfree = true;
};
home = {
username = "reo101";
homeDirectory = "/home/reo101";

View file

@ -22,15 +22,6 @@
# localStorageDir = "${inputs.self}/secrets/rekeyed/${config.networking.hostName}";
};
nixpkgs = {
hostPlatform = "x86_64-linux";
config = {
allowUnfree = true;
};
overlays = [
];
};
networking.hostName = "jeeves";
boot = {

View file

@ -5,12 +5,6 @@
inputs.wired.homeManagerModules.default
];
nixpkgs = {
overlays = builtins.attrValues outputs.overlays;
config.allowUnfree = true;
};
home = {
username = "jeeves";
homeDirectory = "/home/jeeves";