switch to nix-starter-configs

This commit is contained in:
sam 2024-05-09 12:03:13 +01:00
parent b47cbb2d84
commit 73254cd0d3
11 changed files with 195 additions and 38 deletions

View File

@ -21,6 +21,18 @@
} }
}, },
"nixpkgs": { "nixpkgs": {
"locked": {
"lastModified": 0,
"narHash": "sha256-UlRZtrCnhPFSJlDQE7M0eyhgvuuHBTe1eJ9N9AQlJQ0=",
"path": "/nix/store/3pif36ks3f56py4wb1dkq6sh0nkf3ygj-source",
"type": "path"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"nixpkgs-unstable": {
"locked": { "locked": {
"lastModified": 1714906307, "lastModified": 1714906307,
"narHash": "sha256-UlRZtrCnhPFSJlDQE7M0eyhgvuuHBTe1eJ9N9AQlJQ0=", "narHash": "sha256-UlRZtrCnhPFSJlDQE7M0eyhgvuuHBTe1eJ9N9AQlJQ0=",
@ -39,7 +51,8 @@
"root": { "root": {
"inputs": { "inputs": {
"home-manager": "home-manager", "home-manager": "home-manager",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs",
"nixpkgs-unstable": "nixpkgs-unstable"
} }
} }
}, },

105
flake.nix
View File

@ -1,25 +1,106 @@
#{
# description = "Nixos config flake";
#
# inputs = {
# nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
#
# home-manager = {
# url = "github:nix-community/home-manager";
# inputs.nixpkgs.follows = "nixpkgs";
# };
# };
#
# outputs = { self, nixpkgs, ... }@inputs: {
# nixosConfigurations = {
# default = nixpkgs.lib.nixosSystem {
# system = "x86_64-linux";
# specialArgs = {inherit inputs;};
# modules = [
# ./configuration.nix
# ./hosts/default
# #./nixos_modules
# ];
# };
# };
# #homeManagerModules.default = ./homeManager_modules;
# };
#}
{ {
description = "Nixos config flake"; description = "Your new nix config";
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; # Nixpkgs
#nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
# 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"; home-manager.url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs"; home-manager.inputs.nixpkgs.follows = "nixpkgs";
};
}; };
outputs = { self, nixpkgs, ... }@inputs: { outputs = {
nixosConfigurations = { 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
default = nixpkgs.lib.nixosSystem { default = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs;}; specialArgs = {inherit inputs outputs;};
modules = [ modules = [
./hosts/default/configuration.nix # > Our main nixos configuration file <
./nixos_modules ./nixos/configuration.nix
]; ];
}; };
}; };
homeManagerModules.default = ./homeManager_modules;
# # Standalone home-manager configuration entrypoint
# # Available through 'home-manager --flake .#your-username@your-hostname'
# homeConfigurations = {
# # FIXME replace with your username@hostname
# "sam" = 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
# ];
# };
# };
}; };
} }

View File

@ -1,18 +0,0 @@
{ stdenv, fetchFromGitHub }:
{
sddm-sugar-candy-theme = stdenv.mkDerivation rec {
pname = "sddm-sugar-candy-theme";
version = "1.6";
dontBuild = true;
installPhase = ''
mkdir -p $out/share/sddm/themes
cp -aR $src $out/share/sddm/themes/sugar-candy
'';
src = fetchFromGitHub {
owner = "Kangie";
repo = "sddm-sugar-candy";
rev = "v1.6";
sha256 = "sha256-p2d7I0UBP63baW/q9MexYJQcqSmZ0L5rkwK3n66gmqM=";
};
};
}

View File

View File

@ -1,4 +1,4 @@
{ inputs, config, lib, pkgs, ... }: { inputs, config, lib, pkgs, outputs, ... }:
{ {
imports = imports =
@ -6,13 +6,46 @@
./hardware-configuration.nix ./hardware-configuration.nix
inputs.home-manager.nixosModules.home-manager inputs.home-manager.nixosModules.home-manager
]; ];
home-manager = {
extraSpecialArgs = { inherit inputs outputs; };
users = {
# Import your home-manager configuration
sam = import ../home-manager/home.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
home-manager = { # You can also add overlays exported from other flakes:
extraSpecialArgs = { inherit inputs; }; # neovim-nightly-overlay.overlays.default
users = {
sam = import ./home.nix; # 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;
}; };
}; };
# home-manager = {
# extraSpecialArgs = { inherit inputs; };
# users = {
# sam = import ./home.nix;
# };
# };
nix.settings.experimental-features = [ "nix-command" "flakes" ]; nix.settings.experimental-features = [ "nix-command" "flakes" ];
@ -61,10 +94,13 @@
networkmanagerapplet networkmanagerapplet
htop htop
sddm sddm
sshfs-fuse
wdisplays wdisplays
(callPackage ./themes/sddm-sugar-candy.nix{}).sddm-sugar-candy-theme sddm-sugar-candy-theme
wallpaper_changer
#(callPackage ../../nixos_modules/themes/sddm-sugar-candy.nix{}).sddm-sugar-candy-theme
libsForQt5.qt5.qtgraphicaleffects #required for sugar candy libsForQt5.qt5.qtgraphicaleffects #required for sugar candy
(import ./scripts/wallpaper_changer.nix { inherit pkgs; }) #(import ../../nixos_modules/scripts/wallpaper_changer.nix { inherit pkgs; })
]; ];
programs.gnupg.agent = { programs.gnupg.agent = {

23
overlays/default.nix Normal file
View 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 final.pkgs;
# 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;
};
};
}

6
pkgs/default.nix Normal file
View File

@ -0,0 +1,6 @@
# Custom packages, that can be defined similarly to ones from nixpkgs
# You can build them using 'nix build .#example'
pkgs: {
sddm-sugar-candy-theme = pkgs.callPackage ./sddm-sugar-candy.nix { };
wallpaper_changer = pkgs.callPackage ./wallpaper_changer.nix { };
}

16
pkgs/sddm-sugar-candy.nix Normal file
View File

@ -0,0 +1,16 @@
{ pkgs ? import <nixpkgs> { }, stdenv, fetchFromGitHub }:
pkgs.stdenv.mkDerivation rec {
pname = "sddm-sugar-candy-theme";
version = "1.6";
dontBuild = true;
installPhase = ''
mkdir -p $out/share/sddm/themes
cp -aR $src $out/share/sddm/themes/sugar-candy
'';
src = fetchFromGitHub {
owner = "Kangie";
repo = "sddm-sugar-candy";
rev = "v1.6";
sha256 = "sha256-p2d7I0UBP63baW/q9MexYJQcqSmZ0L5rkwK3n66gmqM=";
};
}