add multi-nixpkgs flake
This commit is contained in:
parent
3face7eddd
commit
7bbdfe484c
|
@ -16,6 +16,12 @@
|
|||
'';
|
||||
path = ./standard;
|
||||
};
|
||||
multi-nixpkgs = {
|
||||
description = ''
|
||||
An example, based on the standard flake, on how to use two (or more) nixpkgs versions
|
||||
'';
|
||||
path = ./multi-nixpkgs;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
97
multi-nixpkgs/flake.lock
Normal file
97
multi-nixpkgs/flake.lock
Normal file
|
@ -0,0 +1,97 @@
|
|||
{
|
||||
"nodes": {
|
||||
"hardware": {
|
||||
"locked": {
|
||||
"lastModified": 1667585378,
|
||||
"narHash": "sha256-cvOwucrjBaAkaGk3FunG+MQiwiSBeIVTtO5n/YavpC0=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixos-hardware",
|
||||
"rev": "6b35a59c19ddbbeb229fcd1d3dcd422dcc0fa927",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"repo": "nixos-hardware",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"home-manager": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"utils": "utils"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1667574732,
|
||||
"narHash": "sha256-73TVk3uSQOja6Q/5OuNcpcqwo6+SMzJPRtYAjU0rBx4=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "b764068a506c6f70dba998efa0e7fcb99cb4deb2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1667482890,
|
||||
"narHash": "sha256-pua0jp87iwN7NBY5/ypx0s9L9CG49Ju/NI4wGwurHc4=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "a2a777538d971c6b01c6e54af89ddd6567c055e8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-master": {
|
||||
"locked": {
|
||||
"lastModified": 1667669848,
|
||||
"narHash": "sha256-nD2dk2A+1zUlUT18ppDFVWwimi26+ultc2QRsulQwQ8=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "1f3ebb2bd1a353a42e8f833895c26d8415c7b791",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "master",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"hardware": "hardware",
|
||||
"home-manager": "home-manager",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs-master": "nixpkgs-master"
|
||||
}
|
||||
},
|
||||
"utils": {
|
||||
"locked": {
|
||||
"lastModified": 1667077288,
|
||||
"narHash": "sha256-bdC8sFNDpT0HK74u9fUkpbf1MEzVYJ+ka7NXCdgBoaA=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "6ee9ebb6b1ee695d2cacc4faa053a7b9baa76817",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
83
multi-nixpkgs/flake.nix
Normal file
83
multi-nixpkgs/flake.nix
Normal file
|
@ -0,0 +1,83 @@
|
|||
{
|
||||
description = "Your new nix config";
|
||||
|
||||
inputs = {
|
||||
# Nixpkgs
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
nixpkgs-master.url = "github:nixos/nixpkgs/master";
|
||||
|
||||
# Home manager
|
||||
home-manager.url = "github:nix-community/home-manager";
|
||||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
# TODO: Add any other flake you might need
|
||||
hardware.url = "github:nixos/nixos-hardware";
|
||||
|
||||
# Shameless plug: looking for a way to nixify your themes and make
|
||||
# everything match nicely? Try nix-colors!
|
||||
# nix-colors.url = "github:misterio77/nix-colors";
|
||||
};
|
||||
|
||||
outputs = { nixpkgs, home-manager, ... }@inputs:
|
||||
let
|
||||
forAllSystems = nixpkgs.lib.genAttrs [
|
||||
"aarch64-linux"
|
||||
"i686-linux"
|
||||
"x86_64-linux"
|
||||
"aarch64-darwin"
|
||||
"x86_64-darwin"
|
||||
];
|
||||
in
|
||||
rec {
|
||||
# Your custom packages
|
||||
# Acessible through 'nix build', 'nix shell', etc
|
||||
packages = forAllSystems (system:
|
||||
let pkgs = nixpkgs.legacyPackages.${system};
|
||||
in
|
||||
import ./pkgs { inherit pkgs; }
|
||||
);
|
||||
# Devshell for bootstrapping
|
||||
# Acessible through 'nix develop' or 'nix-shell' (legacy)
|
||||
devShells = forAllSystems (system:
|
||||
let pkgs = nixpkgs.legacyPackages.${system};
|
||||
in
|
||||
import ./shell.nix { inherit pkgs; }
|
||||
);
|
||||
|
||||
# Your custom packages and modifications, exported as overlays
|
||||
overlays = import ./overlays { inherit inputs; };
|
||||
# Reusable nixos modules you might want to export
|
||||
# These are usually stuff you would upstream into nixpkgs
|
||||
nixosModules = import ./modules/nixos;
|
||||
# Reusable home-manager modules you might want to export
|
||||
# These are usually stuff you would upstream into home-manager
|
||||
homeManagerModules = import ./modules/home-manager;
|
||||
|
||||
nixosConfigurations = {
|
||||
# FIXME replace with your hostname
|
||||
your-hostname = nixpkgs.lib.nixosSystem {
|
||||
specialArgs = { inherit inputs; }; # Pass flake inputs to our config
|
||||
modules = (builtins.attrValues nixosModules) ++ [
|
||||
# > Our main nixos configuration file <
|
||||
./nixos/configuration.nix
|
||||
# Our common nixpkgs config (unfree, overlays, etc)
|
||||
(import ./nixpkgs-config.nix { inherit overlays; })
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
homeConfigurations = {
|
||||
# FIXME replace with your username@hostname
|
||||
"your-username@your-hostname" = home-manager.lib.homeManagerConfiguration {
|
||||
pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance
|
||||
extraSpecialArgs = { inherit inputs; }; # Pass flake inputs to our config
|
||||
modules = (builtins.attrValues homeManagerModules) ++ [
|
||||
# > Our main home-manager configuration file <
|
||||
./home-manager/home.nix
|
||||
# Our common nixpkgs config (unfree, overlays, etc)
|
||||
(import ./nixpkgs-config.nix { inherit overlays; })
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
1
multi-nixpkgs/home-manager
Symbolic link
1
multi-nixpkgs/home-manager
Symbolic link
|
@ -0,0 +1 @@
|
|||
../standard/home-manager
|
1
multi-nixpkgs/modules
Symbolic link
1
multi-nixpkgs/modules
Symbolic link
|
@ -0,0 +1 @@
|
|||
../standard/modules
|
1
multi-nixpkgs/nixos
Symbolic link
1
multi-nixpkgs/nixos
Symbolic link
|
@ -0,0 +1 @@
|
|||
../standard/nixos
|
1
multi-nixpkgs/nixpkgs-config.nix
Symbolic link
1
multi-nixpkgs/nixpkgs-config.nix
Symbolic link
|
@ -0,0 +1 @@
|
|||
../standard/nixpkgs-config.nix
|
20
multi-nixpkgs/overlays/default.nix
Normal file
20
multi-nixpkgs/overlays/default.nix
Normal file
|
@ -0,0 +1,20 @@
|
|||
{ inputs, ... }:
|
||||
# This file defines overlays
|
||||
{
|
||||
# Add bleeding edge packages under the 'master' namespace
|
||||
master = final: _prev: {
|
||||
master = inputs.nixpkgs-master.legacyPackages.${final.system};
|
||||
};
|
||||
|
||||
# This one brings our custom packages from the 'pkgs' directory
|
||||
additions = final: _prev: import ../pkgs { pkgs = final; };
|
||||
|
||||
# This one contains whatever you want to overlay
|
||||
# You can change versions, add patches, set compilation flags, anything really.
|
||||
# https://nixos.wiki/wiki/Overlays
|
||||
modifications = final: prev: {
|
||||
# example = prev.example.overrideAttrs (oldAttrs: rec {
|
||||
# ...
|
||||
# });
|
||||
};
|
||||
}
|
1
multi-nixpkgs/pkgs
Symbolic link
1
multi-nixpkgs/pkgs
Symbolic link
|
@ -0,0 +1 @@
|
|||
../standard/pkgs
|
1
multi-nixpkgs/shell.nix
Symbolic link
1
multi-nixpkgs/shell.nix
Symbolic link
|
@ -0,0 +1 @@
|
|||
../standard/shell.nix
|
Loading…
Reference in a new issue