remove old shell code + change nixpkgs/overlay config
This commit is contained in:
107
flake.nix
107
flake.nix
@ -26,110 +26,50 @@
|
|||||||
# Outputs is a function that takes the inputs as arguments.
|
# Outputs is a function that takes the inputs as arguments.
|
||||||
# To handle extra arguments we use the inputs@ pattern.
|
# To handle extra arguments we use the inputs@ pattern.
|
||||||
# It gives a name to the ... ellipses.
|
# It gives a name to the ... ellipses.
|
||||||
outputs = inputs@{ nixpkgs, home-manager, devshell, ... }:
|
outputs = inputs @ { nixpkgs, home-manager, ... }:
|
||||||
|
|
||||||
# With let you can define local variables
|
# With let you can define local variables
|
||||||
let
|
let
|
||||||
# We bring these functions into the scope for the outputs.
|
system = "x86_64-linux";
|
||||||
inherit (builtins) attrValues; # TODO: What does this do
|
|
||||||
|
|
||||||
# Add overlays from other flakes so we can use them from pkgs.
|
|
||||||
overlays = {
|
|
||||||
nur = inputs.nur.overlay;
|
|
||||||
emacs = inputs.emacs-overlay.overlay;
|
|
||||||
};
|
|
||||||
|
|
||||||
pkgs = import nixpkgs {
|
pkgs = import nixpkgs {
|
||||||
system = "x86_64-linux";
|
inherit system;
|
||||||
config.allowUnfree = true;
|
config.allowUnfree = true;
|
||||||
overlays = [ devshell.overlay ];
|
overlays = [
|
||||||
|
inputs.devshell.overlay
|
||||||
|
inputs.nur.overlay
|
||||||
|
inputs.emacs-overlay.overlay
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
# The rec expression turns a basic set into a set where self-referencing is possible.
|
# The rec expression turns a basic set into a set where self-referencing is possible.
|
||||||
# It is a shorthand for recursive and allows to use the values defined in this set from its own scope.
|
# It is a shorthand for recursive and allows to use the values defined in this set from its own scope.
|
||||||
in rec {
|
in rec {
|
||||||
|
|
||||||
devShells."x86_64-linux".default = pkgs.devshell.mkShell {
|
# Local shell for NixFlake directory
|
||||||
name = "NixFlake Shell";
|
devShells."${system}".default = import ./shell.nix { inherit pkgs; };
|
||||||
|
|
||||||
packages = with pkgs; [
|
|
||||||
jetbrains.clion
|
|
||||||
];
|
|
||||||
|
|
||||||
commands = [
|
|
||||||
{
|
|
||||||
name = "ide";
|
|
||||||
help = "Launch clion in this folder";
|
|
||||||
command = "clion ./ &>/dev/null &";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "update";
|
|
||||||
help = "Update the flake";
|
|
||||||
command = "nix flake update";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "check";
|
|
||||||
help = "Validate the flake";
|
|
||||||
command = "nix flake check";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "pkgs-sys";
|
|
||||||
help = "List currently installed system packages";
|
|
||||||
command = "bat /etc/current-system-packages";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "pkgs-usr";
|
|
||||||
help = "List currently installed user packages";
|
|
||||||
command = "bat ~/.local/share/current-user-packages";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "switch-nixinator";
|
|
||||||
help = "Rebuild and activate the nixinator config";
|
|
||||||
command = "sudo nixos-rebuild switch --flake .#nixinator";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "build-nixinator";
|
|
||||||
help = "Rebuild and diff the nixinator config";
|
|
||||||
command = "sudo nixos-rebuild build --flake .#nixinator | nvd diff /run/current-system result";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "switch-nixtop";
|
|
||||||
help = "Rebuild and activate the nixtop config";
|
|
||||||
command = "sudo nixos-rebuild switch --flake .#nixtop";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "build-nixtop";
|
|
||||||
help = "Rebuild and diff the nixtop config";
|
|
||||||
command = "sudo nixos-rebuild build --flake .#nixtop | nvd diff /run/current-system result";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
# System configurations + HomeManager module
|
# System configurations + HomeManager module
|
||||||
# Accessible via 'nixos-rebuild'
|
# Accessible via 'nixos-rebuild'
|
||||||
|
# TODO: Add some sort of lib function to deduplicate the configs (they are mostly the same except for the modules)
|
||||||
nixosConfigurations = {
|
nixosConfigurations = {
|
||||||
|
|
||||||
# We give our configuration a name (the hostname) to choose a configuration when rebuilding.
|
# We give our configuration a name (the hostname) to choose a configuration when rebuilding.
|
||||||
# This makes it easy to add different configurations later (e.g. for a laptop).
|
# This makes it easy to add different configurations later (e.g. for a laptop).
|
||||||
# Usage: sudo nixos-rebuild switch --flake .#nixinator
|
# Usage: sudo nixos-rebuild switch --flake .#nixinator
|
||||||
nixinator = nixpkgs.lib.nixosSystem {
|
nixinator = nixpkgs.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
inherit system;
|
||||||
|
|
||||||
# >> Main NixOS configuration file <<
|
# >> Main NixOS configuration file <<
|
||||||
modules = [
|
modules = [
|
||||||
|
# TODO: Can this be set globally?
|
||||||
|
{ nixpkgs = { inherit pkgs; }; }
|
||||||
|
|
||||||
inputs.musnix.nixosModules.musnix
|
inputs.musnix.nixosModules.musnix
|
||||||
|
|
||||||
# TODO: Modularize
|
|
||||||
./nixos/configuration.nix
|
./nixos/configuration.nix
|
||||||
./nixos/configuration-nixinator.nix
|
./nixos/configuration-nixinator.nix
|
||||||
|
|
||||||
# TODO: Investigate this { ... } module syntax
|
|
||||||
# Overlays
|
|
||||||
{
|
|
||||||
# Since HomeManager uses global pkgs we can set the overlays here
|
|
||||||
nixpkgs.overlays = attrValues overlays;
|
|
||||||
}
|
|
||||||
|
|
||||||
# HomeManager
|
# HomeManager
|
||||||
home-manager.nixosModules.home-manager
|
home-manager.nixosModules.home-manager
|
||||||
{
|
{
|
||||||
@ -137,7 +77,7 @@
|
|||||||
home-manager.useUserPackages = true; # Enable installing packages through users.christoph.packages to /etc/profiles instead of ~/.nix-profile
|
home-manager.useUserPackages = true; # Enable installing packages through users.christoph.packages to /etc/profiles instead of ~/.nix-profile
|
||||||
home-manager.users.christoph = import ./home/home.nix;
|
home-manager.users.christoph = import ./home/home.nix;
|
||||||
|
|
||||||
# Make our overlays available in home.nix
|
# Make our inputs available in home.nix
|
||||||
home-manager.extraSpecialArgs = { inherit inputs; };
|
home-manager.extraSpecialArgs = { inherit inputs; };
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
@ -147,21 +87,16 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
nixtop = nixpkgs.lib.nixosSystem {
|
nixtop = nixpkgs.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
inherit system;
|
||||||
|
|
||||||
# >> Main NixOS configuration file <<
|
# >> Main NixOS configuration file <<
|
||||||
modules = [
|
modules = [
|
||||||
# TODO: Modularize
|
# TODO: Can this be set globally?
|
||||||
|
{ nixpkgs = { inherit pkgs; }; }
|
||||||
|
|
||||||
./nixos/configuration.nix
|
./nixos/configuration.nix
|
||||||
./nixos/configuration-nixtop.nix
|
./nixos/configuration-nixtop.nix
|
||||||
|
|
||||||
# TODO: Investigate this { ... } module syntax
|
|
||||||
# Overlays
|
|
||||||
{
|
|
||||||
# Since HomeManager uses global pkgs we can set the overlays here
|
|
||||||
nixpkgs.overlays = attrValues overlays;
|
|
||||||
}
|
|
||||||
|
|
||||||
# HomeManager
|
# HomeManager
|
||||||
home-manager.nixosModules.home-manager
|
home-manager.nixosModules.home-manager
|
||||||
{
|
{
|
||||||
@ -169,7 +104,7 @@
|
|||||||
home-manager.useUserPackages = true; # Enable installing packages through users.christoph.packages
|
home-manager.useUserPackages = true; # Enable installing packages through users.christoph.packages
|
||||||
home-manager.users.christoph = import ./home/home.nix;
|
home-manager.users.christoph = import ./home/home.nix;
|
||||||
|
|
||||||
# Make our overlays available in home.nix
|
# Make our inputs available in home.nix
|
||||||
home-manager.extraSpecialArgs = { inherit inputs; };
|
home-manager.extraSpecialArgs = { inherit inputs; };
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
Reference in New Issue
Block a user