Modernizing overlay

This commit is contained in:
Natsu Kagami 2022-07-04 15:41:04 -04:00
parent 53a04459c2
commit c9ee01f65e
Signed by: nki
GPG key ID: 7306B3D3C3AD6E51
4 changed files with 41 additions and 53 deletions

View file

@ -16,27 +16,12 @@ with lib;
]; ];
homebrew.brews = [ homebrew.brews = [
# Base libraries
"coreutils"
# Compilers and Language Interpreters
"elm"
"llvm"
"luajit-openresty"
"node"
"perl"
"ruby@2.7"
# CLI tools # CLI tools
"pinentry-mac" # UI for Pin Entry on gpg Mac "pinentry-mac" # UI for Pin Entry on gpg Mac
# U2F # U2F
"pam-u2f" "pam-u2f"
] ++ (optionals (pkgs.system == "aarch64-darwin") [ ];
# Because python on Nix is a bit abababa
"python@3.9"
"scipy"
]);
homebrew.casks = [ homebrew.casks = [
"anki" "anki"

View file

@ -16,7 +16,7 @@
# Auto upgrade nix package and the daemon service. # Auto upgrade nix package and the daemon service.
# services.nix-daemon.enable = true; # services.nix-daemon.enable = true;
nix.package = pkgs.nixUnstable; nix.package = pkgs.nixFlakes;
# Create /etc/bashrc that loads the nix-darwin environment. # Create /etc/bashrc that loads the nix-darwin environment.
programs.zsh.enable = true; # default shell on catalina programs.zsh.enable = true; # default shell on catalina
@ -25,9 +25,6 @@
## Networking related settings ## Networking related settings
networking.hostName = "nki-macbook"; networking.hostName = "nki-macbook";
## Programs
nixpkgs.config.allowUnfree = true;
environment.variables = { environment.variables = {
EDITOR = ""; # don't set it by default EDITOR = ""; # don't set it by default

View file

@ -29,10 +29,13 @@
outputs = { self, darwin, nixpkgs, nixpkgs-unstable, home-manager, deploy-rs, sops-nix, nur, ... }@inputs: outputs = { self, darwin, nixpkgs, nixpkgs-unstable, home-manager, deploy-rs, sops-nix, nur, ... }@inputs:
let let
overlayForSystem = import ./overlay.nix inputs; overlays = import ./overlay.nix inputs;
nixpkgsAsRegistry = { ... }: { pkgs = system: import nixpkgs { inherit system overlays; };
nix.registry.nixpkgs.flake = nixpkgs; pkgs-unstable = system: import nixpkgs-unstable { inherit system overlays; };
nixpkgsAsRegistry_ = stable: { ... }: {
nix.registry.nixpkgs.flake = stable;
nix.registry.nixpkgs-unstable.flake = nixpkgs-unstable; nix.registry.nixpkgs-unstable.flake = nixpkgs-unstable;
nix.nixPath = [ nix.nixPath = [
"nixpkgs=${nixpkgs}" "nixpkgs=${nixpkgs}"
@ -40,6 +43,17 @@
"/nix/var/nix/profiles/per-user/root/channels" "/nix/var/nix/profiles/per-user/root/channels"
]; ];
}; };
nixpkgsAsRegistry = nixpkgsAsRegistry_ nixpkgs;
haskellDotNix = { ... }: {
# Binary Cache for Haskell.nix
nix.binaryCachePublicKeys = [
"hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="
];
nix.binaryCaches = [
"https://cache.iog.io"
];
};
enableOsuStable = { lib, ... }: { enableOsuStable = { lib, ... }: {
imports = [ inputs.nix-gaming.nixosModules.pipewireLowLatency ]; imports = [ inputs.nix-gaming.nixosModules.pipewireLowLatency ];
@ -63,31 +77,26 @@
in in
{ {
# MacBook configuration: nix-darwin + home-manager # MacBook configuration: nix-darwin + home-manager
darwinConfigurations."nki-macbook" = darwin.lib.darwinSystem { darwinConfigurations."nki-macbook" = darwin.lib.darwinSystem rec {
system = "aarch64-darwin"; system = "aarch64-darwin";
pkgs = pkgs-unstable system;
modules = [ modules = [
./darwin/configuration.nix ./darwin/configuration.nix
# Set nix path # Set nix path
({ ... }: { haskellDotNix
nix.nixPath = [ (nixpkgsAsRegistry_ nixpkgs-unstable)
"nixpkgs=${nixpkgs-unstable}"
"nixpkgs-unstable=${nixpkgs-unstable}"
"/nix/var/nix/profiles/per-user/root/channels"
"\$HOME/.nix-defexpr/channels"
];
})
home-manager.darwinModules.home-manager home-manager.darwinModules.home-manager
{ {
home-manager.useGlobalPkgs = true; home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true; home-manager.useUserPackages = true;
home-manager.users.nki = import ./home/macbook-home.nix; home-manager.users.nki = import ./home/macbook-home.nix;
} }
(overlayForSystem "aarch64-darwin")
]; ];
}; };
# Home configuration # Home configuration
nixosConfigurations."nki-home" = nixpkgs.lib.nixosSystem { nixosConfigurations."nki-home" = nixpkgs.lib.nixosSystem rec {
pkgs = pkgs system;
system = "x86_64-linux"; system = "x86_64-linux";
modules = [ modules = [
./modules/my-tinc ./modules/my-tinc
@ -102,11 +111,11 @@
home-manager.users.nki = import ./home/kagami-pc-home.nix; home-manager.users.nki = import ./home/kagami-pc-home.nix;
} }
inputs.secrets.nixosModules.x86_64-linux.common inputs.secrets.nixosModules.x86_64-linux.common
(overlayForSystem "x86_64-linux")
]; ];
}; };
# x1c1 configuration # x1c1 configuration
nixosConfigurations."nki-x1c1" = nixpkgs.lib.nixosSystem { nixosConfigurations."nki-x1c1" = nixpkgs.lib.nixosSystem rec {
pkgs = pkgs system;
system = "x86_64-linux"; system = "x86_64-linux";
modules = [ modules = [
./modules/my-tinc ./modules/my-tinc
@ -119,12 +128,12 @@
home-manager.useUserPackages = true; home-manager.useUserPackages = true;
home-manager.users.nki = import ./home/nki-x1c1.nix; home-manager.users.nki = import ./home/nki-x1c1.nix;
} }
(overlayForSystem "x86_64-linux")
]; ];
}; };
# DigitalOcean node # DigitalOcean node
nixosConfigurations."nki-personal-do" = nixpkgs.lib.nixosSystem { nixosConfigurations."nki-personal-do" = nixpkgs.lib.nixosSystem rec {
pkgs = pkgs system;
system = "x86_64-linux"; system = "x86_64-linux";
modules = [ modules = [
./modules/my-tinc ./modules/my-tinc
@ -132,7 +141,6 @@
sops-nix.nixosModules.sops sops-nix.nixosModules.sops
./nki-personal-do/configuration.nix ./nki-personal-do/configuration.nix
inputs.secrets.nixosModules.x86_64-linux.nki-personal-do inputs.secrets.nixosModules.x86_64-linux.nki-personal-do
(overlayForSystem "x86_64-linux")
]; ];
}; };
deploy.nodes."nki-personal-do" = { deploy.nodes."nki-personal-do" = {

View file

@ -1,20 +1,19 @@
{ nixpkgs, nixpkgs-unstable, nur, ... }@inputs: system: { nixpkgs, nixpkgs-unstable, nur, ... }@inputs:
let let
overlay-unstable = final: prev: { overlay-unstable = final: prev: {
unstable = import nixpkgs-unstable { config.allowUnfree = true; system = prev.system; }; unstable = import nixpkgs-unstable { config.allowUnfree = true; system = prev.system; };
unfree = import nixpkgs { config.allowUnfree = true; system = prev.system; }; unfree = import nixpkgs { config.allowUnfree = true; system = prev.system; };
x86 = import nixpkgs-unstable { system = "${system}"; config.allowUnsupportedSystem = true; }; x86 = import nixpkgs-unstable { system = prev.system; config.allowUnsupportedSystem = true; };
}; };
overlay-needs-unstable = final: prev: { overlay-needs-unstable = final: prev: {
# override some packages that needs unstable that cannot be changed in the setup. # override some packages that needs unstable that cannot be changed in the setup.
nix-direnv = prev.unstable.nix-direnv; nix-direnv = prev.unstable.nix-direnv;
}; };
overlay-imported = final: prev: { overlay-imported = final: prev: {
rnix-lsp = inputs.rnix-lsp.defaultPackage."${system}"; rnix-lsp = inputs.rnix-lsp.defaultPackage."${prev.system}";
}; };
in in
{ [
nixpkgs.overlays = [
(import ./overlays/openrazer) (import ./overlays/openrazer)
overlay-unstable overlay-unstable
overlay-needs-unstable overlay-needs-unstable
@ -23,6 +22,5 @@ in
# Bug fixes # Bug fixes
(import ./overlays/bugfixes/delta) (import ./overlays/bugfixes/delta)
]; # we assign the overlay created before to the overlays of nixpkgs. ] # we assign the overlay created before to the overlays of nixpkgs.
}