standard template finalised
This commit is contained in:
parent
ac881e7a4a
commit
d6805af85d
@ -1,12 +1,13 @@
|
||||
{
|
||||
description = ''
|
||||
My personal NixOS Flake templates!
|
||||
|
||||
For questions just DM me on X: https://twitter.com/@m3tam3re
|
||||
There is also some NIXOS content on my YT channel: https://www.youtube.com/@m3tam3re
|
||||
|
||||
One of the best ways to learn NIXOS is to read other peoples configurations. I have personally learned a lot from Gabriel Fontes configs:
|
||||
https://github.com/Misterio77/nix-starter-configs
|
||||
https://github.com/Misterio77/nix-config
|
||||
|
||||
Please also check out the starter configs mentioned above.
|
||||
'';
|
||||
|
||||
inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; };
|
||||
|
65
nixos/standard/flake.lock
generated
Normal file
65
nixos/standard/flake.lock
generated
Normal file
@ -0,0 +1,65 @@
|
||||
{
|
||||
"nodes": {
|
||||
"home-manager": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1712016346,
|
||||
"narHash": "sha256-O2nO7pD+krq+4HgkLB4VThRtAucIPfXDs/jJqCGlK1w=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "4be0464472675212654dedf3e021bd5f1d58b92f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1711703276,
|
||||
"narHash": "sha256-iMUFArF0WCatKK6RzfUJknjem0H9m4KgorO/p3Dopkk=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "d8fe5e6c92d0d190646fb9f1056741a229980089",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-stable": {
|
||||
"locked": {
|
||||
"lastModified": 1711668574,
|
||||
"narHash": "sha256-u1dfs0ASQIEr1icTVrsKwg2xToIpn7ZXxW3RHfHxshg=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "219951b495fc2eac67b1456824cc1ec1fd2ee659",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-23.11",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"home-manager": "home-manager",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs-stable": "nixpkgs-stable"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
@ -1,5 +1,14 @@
|
||||
{
|
||||
description = "A very basic flake";
|
||||
description = ''
|
||||
For questions just DM me on X: https://twitter.com/@m3tam3re
|
||||
There is also some NIXOS content on my YT channel: https://www.youtube.com/@m3tam3re
|
||||
|
||||
One of the best ways to learn NIXOS is to read other peoples configurations. I have personally learned a lot from Gabriel Fontes configs:
|
||||
https://github.com/Misterio77/nix-starter-configs
|
||||
https://github.com/Misterio77/nix-config
|
||||
|
||||
Please also check out the starter configs mentioned above.
|
||||
'';
|
||||
|
||||
inputs = {
|
||||
home-manager = {
|
||||
@ -7,14 +16,36 @@
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-23.11";
|
||||
};
|
||||
|
||||
outputs = { self, home-manager, nixpkgs }@inputs: {
|
||||
nixosConfigurations = {
|
||||
your-host = nixpkgs.lib.nixosSystem {
|
||||
specialArgs = { inherit inputs; };
|
||||
modules = [ ./hosts/your-host ];
|
||||
outputs = { self, home-manager, nixpkgs, ... }@inputs:
|
||||
let
|
||||
inherit (self) outputs;
|
||||
systems = [
|
||||
"aarch64-linux"
|
||||
"i686-linux"
|
||||
"x86_64-linux"
|
||||
"aarch64-darwin"
|
||||
"x86_64-darwin"
|
||||
];
|
||||
forAllSystems = nixpkgs.lib.genAttrs systems;
|
||||
in {
|
||||
packages =
|
||||
forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system});
|
||||
overlays = import ./overlays { inherit inputs; };
|
||||
nixosConfigurations = {
|
||||
your-host = nixpkgs.lib.nixosSystem {
|
||||
specialArgs = { inherit inputs outputs; };
|
||||
modules = [ ./hosts/your-host ];
|
||||
};
|
||||
};
|
||||
homeConfigurations = {
|
||||
"your-name@your-host" = home-manager.lib.homeManagerConfiguration {
|
||||
pkgs = nixpkgs.legacyPackages."x86_64-linux";
|
||||
extraSpecialArgs = { inherit inputs outputs; };
|
||||
modules = [ ./home/your-name/your-host.nix ];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
{ config, lib, pkgs, ... }: {
|
||||
{ config, lib, outputs, pkgs, ... }: {
|
||||
nixpkgs = {
|
||||
# You can add overlays here
|
||||
overlays = [
|
||||
# Add overlays your own flake exports (from overlays and pkgs dir):
|
||||
#outputs.overlays.additions
|
||||
#outputs.overlays.modifications
|
||||
#outputs.overlays.stable-packages
|
||||
outputs.overlays.additions
|
||||
outputs.overlays.modifications
|
||||
outputs.overlays.stable-packages
|
||||
|
||||
# You can also add overlays exported from other flakes:
|
||||
# neovim-nightly-overlay.overlays.default
|
||||
|
@ -1,10 +1,38 @@
|
||||
# Common configuration for all hosts
|
||||
|
||||
{ config, lib, inputs, ... }: {
|
||||
{ lib, inputs, outputs, ... }: {
|
||||
nixpkgs = {
|
||||
# You can add overlays here
|
||||
overlays = [
|
||||
# Add overlays your own flake exports (from overlays and pkgs dir):
|
||||
outputs.overlays.additions
|
||||
outputs.overlays.modifications
|
||||
outputs.overlays.stable-packages
|
||||
|
||||
# You can also add 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;
|
||||
};
|
||||
};
|
||||
|
||||
nix = {
|
||||
settings = {
|
||||
experimental-features = "nix-command flakes";
|
||||
trusted-users = [ "root" "m3tam3re" ];
|
||||
trusted-users = [
|
||||
"root"
|
||||
"your-user"
|
||||
]; # Set users that are allowed to use the flake command
|
||||
};
|
||||
gc = {
|
||||
automatic = true;
|
||||
|
@ -4,7 +4,7 @@
|
||||
#
|
||||
# Please make sure to change the first couple of lines in your configuration.nix:
|
||||
|
||||
# { config, inputs, lib, pkgs, ... }:
|
||||
# { config, inputs, ouputs, lib, pkgs, ... }:
|
||||
#
|
||||
# {
|
||||
# imports = [ # Include the results of the hardware scan.
|
||||
@ -26,9 +26,15 @@
|
||||
#
|
||||
# home-manager = {
|
||||
# useUserPackages = true;
|
||||
# extraSpecialArgs = { inherit inputs outputs; };
|
||||
# users.your-name =
|
||||
# import ../../home/your-name/${config.networking.hostName}.nix;
|
||||
# };
|
||||
#
|
||||
# Please also change your hostname accordingly:
|
||||
#:w
|
||||
|
||||
# networking.hostName = "nixos"; # Define your hostname.
|
||||
|
||||
{
|
||||
imports = [ ../common ./configuration.nix ];
|
||||
|
21
nixos/standard/overlays/default.nix
Normal file
21
nixos/standard/overlays/default.nix
Normal file
@ -0,0 +1,21 @@
|
||||
{ inputs, ... }: {
|
||||
# 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 {
|
||||
# ...
|
||||
# });
|
||||
};
|
||||
|
||||
stable-packages = final: _prev: {
|
||||
stable = import inputs.nixpkgs-stable {
|
||||
system = final.system;
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
};
|
||||
}
|
5
nixos/standard/pkgs/default.nix
Normal file
5
nixos/standard/pkgs/default.nix
Normal file
@ -0,0 +1,5 @@
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
# Define your custom packages here
|
||||
# my-package = pkgs.callPackage ./my-package {};
|
||||
}
|
2
nixos/standard/pkgs/my-package/default.nix
Normal file
2
nixos/standard/pkgs/my-package/default.nix
Normal file
@ -0,0 +1,2 @@
|
||||
# Your custom nix-package
|
||||
# ...
|
Loading…
x
Reference in New Issue
Block a user