Initial commit
This commit is contained in:
commit
fb4fdfb763
66
flake.lock
Normal file
66
flake.lock
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"home-manager": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1685599623,
|
||||||
|
"narHash": "sha256-Tob4CMOVHue0D3RzguDBCtUmX5ji2PsdbQDbIOIKvsc=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "home-manager",
|
||||||
|
"rev": "93db05480c0c0f30382d3e80779e8386dcb4f9dd",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"ref": "release-23.05",
|
||||||
|
"repo": "home-manager",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1686431482,
|
||||||
|
"narHash": "sha256-oPVQ/0YP7yC2ztNsxvWLrV+f0NQ2QAwxbrZ+bgGydEM=",
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "d3bb401dcfc5a46ce51cdfb5762e70cc75d082d2",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nixos",
|
||||||
|
"ref": "nixos-23.05",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs-unstable": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1686501370,
|
||||||
|
"narHash": "sha256-G0WuM9fqTPRc2URKP9Lgi5nhZMqsfHGrdEbrLvAPJcg=",
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "75a5ebf473cd60148ba9aec0d219f72e5cf52519",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nixos",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"home-manager": "home-manager",
|
||||||
|
"nixpkgs": "nixpkgs",
|
||||||
|
"nixpkgs-unstable": "nixpkgs-unstable"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
86
flake.nix
Normal file
86
flake.nix
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
{
|
||||||
|
description = "Your new nix config";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
# Nixpkgs
|
||||||
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05";
|
||||||
|
# You can access packages and modules from different nixpkgs revs
|
||||||
|
# at the same time. Here's an working example:
|
||||||
|
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
|
# Also see the 'unstable-packages' overlay at 'overlays/default.nix'.
|
||||||
|
|
||||||
|
# Home manager
|
||||||
|
home-manager.url = "github:nix-community/home-manager/release-23.05";
|
||||||
|
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 = {
|
||||||
|
self,
|
||||||
|
nixpkgs,
|
||||||
|
home-manager,
|
||||||
|
...
|
||||||
|
} @ inputs: let
|
||||||
|
inherit (self) outputs;
|
||||||
|
# Supported systems for your flake packages, shell, etc.
|
||||||
|
systems = [
|
||||||
|
"aarch64-linux"
|
||||||
|
"i686-linux"
|
||||||
|
"x86_64-linux"
|
||||||
|
"aarch64-darwin"
|
||||||
|
"x86_64-darwin"
|
||||||
|
];
|
||||||
|
# This is a function that generates an attribute by calling a function you
|
||||||
|
# pass to it, with each system as an argument
|
||||||
|
forAllSystems = nixpkgs.lib.genAttrs systems;
|
||||||
|
in {
|
||||||
|
# Your custom packages
|
||||||
|
# Accessible through 'nix build', 'nix shell', etc
|
||||||
|
packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system});
|
||||||
|
# Formatter for your nix files, available through 'nix fmt'
|
||||||
|
# Other options beside 'alejandra' include 'nixpkgs-fmt'
|
||||||
|
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra);
|
||||||
|
|
||||||
|
# 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;
|
||||||
|
|
||||||
|
# NixOS configuration entrypoint
|
||||||
|
# Available through 'nixos-rebuild --flake .#your-hostname'
|
||||||
|
nixosConfigurations = {
|
||||||
|
# FIXME replace with your hostname
|
||||||
|
athame = nixpkgs.lib.nixosSystem {
|
||||||
|
specialArgs = {inherit inputs outputs;};
|
||||||
|
modules = [
|
||||||
|
# > Our main nixos configuration file <
|
||||||
|
./nixos/configuration.nix
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Standalone home-manager configuration entrypoint
|
||||||
|
# Available through 'home-manager --flake .#your-username@your-hostname'
|
||||||
|
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 outputs;};
|
||||||
|
modules = [
|
||||||
|
# > Our main home-manager configuration file <
|
||||||
|
./home-manager/home.nix
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
69
home-manager/home.nix
Normal file
69
home-manager/home.nix
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
# This is your home-manager configuration file
|
||||||
|
# Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix)
|
||||||
|
{
|
||||||
|
inputs,
|
||||||
|
outputs,
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
# You can import other home-manager modules here
|
||||||
|
imports = [
|
||||||
|
# If you want to use modules your own flake exports (from modules/home-manager):
|
||||||
|
# outputs.homeManagerModules.example
|
||||||
|
|
||||||
|
# Or modules exported from other flakes (such as nix-colors):
|
||||||
|
# inputs.nix-colors.homeManagerModules.default
|
||||||
|
|
||||||
|
# You can also split up your configuration and import pieces of it here:
|
||||||
|
# ./nvim.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
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.unstable-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;
|
||||||
|
# Workaround for https://github.com/nix-community/home-manager/issues/2942
|
||||||
|
allowUnfreePredicate = _: true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# TODO: Set your username
|
||||||
|
home = {
|
||||||
|
username = "your-username";
|
||||||
|
homeDirectory = "/home/your-username";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Add stuff for your user as you see fit:
|
||||||
|
# programs.neovim.enable = true;
|
||||||
|
# home.packages = with pkgs; [ steam ];
|
||||||
|
|
||||||
|
# Enable home-manager and git
|
||||||
|
programs.home-manager.enable = true;
|
||||||
|
programs.git.enable = true;
|
||||||
|
|
||||||
|
# Nicely reload system units when changing configs
|
||||||
|
systemd.user.startServices = "sd-switch";
|
||||||
|
|
||||||
|
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
|
||||||
|
home.stateVersion = "23.05";
|
||||||
|
}
|
6
modules/home-manager/default.nix
Normal file
6
modules/home-manager/default.nix
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# Add your reusable home-manager modules to this directory, on their own file (https://nixos.wiki/wiki/Module).
|
||||||
|
# These should be stuff you would like to share with others, not your personal configurations.
|
||||||
|
{
|
||||||
|
# List your module files here
|
||||||
|
# my-module = import ./my-module.nix;
|
||||||
|
}
|
6
modules/nixos/default.nix
Normal file
6
modules/nixos/default.nix
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# Add your reusable NixOS modules to this directory, on their own file (https://nixos.wiki/wiki/Module).
|
||||||
|
# These should be stuff you would like to share with others, not your personal configurations.
|
||||||
|
{
|
||||||
|
# List your module files here
|
||||||
|
# my-module = import ./my-module.nix;
|
||||||
|
}
|
105
nixos/configuration.nix
Normal file
105
nixos/configuration.nix
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
# This is your system's configuration file.
|
||||||
|
# Use this to configure your system environment (it replaces /etc/nixos/configuration.nix)
|
||||||
|
{
|
||||||
|
inputs,
|
||||||
|
outputs,
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
# You can import other NixOS modules here
|
||||||
|
imports = [
|
||||||
|
# If you want to use modules your own flake exports (from modules/nixos):
|
||||||
|
# outputs.nixosModules.example
|
||||||
|
|
||||||
|
# Or modules from other flakes (such as nixos-hardware):
|
||||||
|
# inputs.hardware.nixosModules.common-cpu-amd
|
||||||
|
# inputs.hardware.nixosModules.common-ssd
|
||||||
|
|
||||||
|
# You can also split up your configuration and import pieces of it here:
|
||||||
|
# ./users.nix
|
||||||
|
|
||||||
|
# Import your generated (nixos-generate-config) hardware configuration
|
||||||
|
./hardware-configuration.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
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.unstable-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;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# This will add each flake input as a registry
|
||||||
|
# To make nix3 commands consistent with your flake
|
||||||
|
nix.registry = (lib.mapAttrs (_: flake: {inherit flake;})) ((lib.filterAttrs (_: lib.isType "flake")) inputs);
|
||||||
|
|
||||||
|
# This will additionally add your inputs to the system's legacy channels
|
||||||
|
# Making legacy nix commands consistent as well, awesome!
|
||||||
|
nix.nixPath = ["/etc/nix/path"];
|
||||||
|
environment.etc =
|
||||||
|
lib.mapAttrs'
|
||||||
|
(name: value: {
|
||||||
|
name = "nix/path/${name}";
|
||||||
|
value.source = value.flake;
|
||||||
|
})
|
||||||
|
config.nix.registry;
|
||||||
|
|
||||||
|
nix.settings = {
|
||||||
|
# Enable flakes and new 'nix' command
|
||||||
|
experimental-features = "nix-command flakes";
|
||||||
|
# Deduplicate and optimize nix store
|
||||||
|
auto-optimise-store = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# FIXME: Add the rest of your current configuration
|
||||||
|
|
||||||
|
# TODO: Set your hostname
|
||||||
|
networking.hostName = "your-hostname";
|
||||||
|
|
||||||
|
boot.loader.systemd-boot.enable = true;
|
||||||
|
|
||||||
|
users.users = {
|
||||||
|
traverseda = {
|
||||||
|
initialPassword = "changeme";
|
||||||
|
isNormalUser = true;
|
||||||
|
openssh.authorizedKeys.keys = [
|
||||||
|
];
|
||||||
|
extraGroups = [ "networkmanager" "wheel" "dialout" "docker" "plugdev" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# This setups a SSH server. Very important if you're setting up a headless system.
|
||||||
|
# Feel free to remove if you don't need it.
|
||||||
|
services.openssh = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
# Forbid root login through SSH.
|
||||||
|
PermitRootLogin = "no";
|
||||||
|
# Use keys only. Remove if you want to SSH using password (not recommended)
|
||||||
|
PasswordAuthentication = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
|
||||||
|
system.stateVersion = "23.05";
|
||||||
|
}
|
10
nixos/hardware-configuration.nix
Normal file
10
nixos/hardware-configuration.nix
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# This is just an example, you should generate yours with nixos-generate-config and put it in here.
|
||||||
|
{
|
||||||
|
fileSystems."/" = {
|
||||||
|
device = "/dev/sda1";
|
||||||
|
fsType = "ext4";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Set your system kind (needed for flakes)
|
||||||
|
nixpkgs.hostPlatform = "x86_64-linux";
|
||||||
|
}
|
23
overlays/default.nix
Normal file
23
overlays/default.nix
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# This file defines overlays
|
||||||
|
{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 {
|
||||||
|
# ...
|
||||||
|
# });
|
||||||
|
};
|
||||||
|
|
||||||
|
# When applied, the unstable nixpkgs set (declared in the flake inputs) will
|
||||||
|
# be accessible through 'pkgs.unstable'
|
||||||
|
unstable-packages = final: _prev: {
|
||||||
|
unstable = import inputs.nixpkgs-unstable {
|
||||||
|
system = final.system;
|
||||||
|
config.allowUnfree = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
5
pkgs/default.nix
Normal file
5
pkgs/default.nix
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# Custom packages, that can be defined similarly to ones from nixpkgs
|
||||||
|
# You can build them using 'nix build .#example'
|
||||||
|
pkgs: {
|
||||||
|
# example = pkgs.callPackage ./example { };
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user