more packages, more modular

This commit is contained in:
John Bowdre 2023-07-28 17:15:33 -05:00
parent 2e628b7c4d
commit b4116247ca
15 changed files with 144 additions and 113 deletions

View file

@ -1,5 +1,20 @@
{ {
"nodes": { "nodes": {
"hardware": {
"locked": {
"lastModified": 1690200740,
"narHash": "sha256-aRkEXGmCbAGcvDcdh/HB3YN+EvoPoxmJMOaqRZmf6vM=",
"owner": "nixos",
"repo": "nixos-hardware",
"rev": "ba9650b14e83b365fb9e731f7d7c803f22d2aecf",
"type": "github"
},
"original": {
"owner": "nixos",
"repo": "nixos-hardware",
"type": "github"
}
},
"home-manager": { "home-manager": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -55,6 +70,7 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"hardware": "hardware",
"home-manager": "home-manager", "home-manager": "home-manager",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"nixpkgs-unstable": "nixpkgs-unstable" "nixpkgs-unstable": "nixpkgs-unstable"

View file

@ -1,8 +1,11 @@
{ {
description = "A Very Flakey Home Manager"; description = "A Very Flakey Home Manager";
# Initial layout shamelessly stolen from:
# - https://github.com/Misterio77/nix-starter-configs/
# - https://github.com/Misterio77/nix-config/
inputs = { inputs = {
# Nixpkgs
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05"; nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05";
# You can access packages and modules from different nixpkgs revs # You can access packages and modules from different nixpkgs revs
# at the same time. Here's a working example: # at the same time. Here's a working example:
@ -15,81 +18,49 @@
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
# TODO: Add any other flake you might need # Hardware
# hardware.url = "github.com/nixos/nixos-hardware"; hardware.url = "github:nixos/nixos-hardware";
}; };
outputs = { self, nixpkgs, home-manager, ... } @ inputs: outputs = { self, nixpkgs, home-manager, ... } @ inputs:
let let
inherit (self) outputs; inherit (self) outputs;
forAllSystems = nixpkgs.lib.genAttrs [ lib = nixpkgs.lib // home-manager.lib;
"aarch64-linux" systems = [ "x86_64-linux" "aarch64-linux" ];
"x86_64-linux" forEachSystem = f: lib.genAttrs systems (sys: f pkgsFor.${sys});
]; pkgsFor = nixpkgs.legacyPackages;
in in
rec { {
# Your custom packages inherit lib;
# Accessible through 'nix build', 'nix shell', etc
packages = forAllSystems (system:
let pkgs = nixpkgs.legacyPackages.${system};
in import ./nix/pkgs { inherit pkgs; }
);
# Devshell for bootstrapping
# Accessible through 'nix develop' or 'nix-shell' (legacy)
devShells = forAllSystems (system:
let pkgs = nixpkgs.legacyPackages.${system};
in import ./nix/shell.nix { inherit pkgs; }
);
# Your custom packages and modifications, exported as overlays
overlays = import ./nix/overlays { inherit inputs; };
# Reusable nixos modules you might want to export
# These are usually stuff you would upstream into nixpkgs
nixosModules = import ./nix/modules/nixos; nixosModules = import ./nix/modules/nixos;
# Reusable home-manager modules you might want to export
# These are usually stuff you would upstream into home-manager
homeManagerModules = import ./nix/modules/home-manager; homeManagerModules = import ./nix/modules/home-manager;
# NixOS configuration entrypoint overlays = import ./nix/overlays { inherit inputs outputs; };
# Available through 'nixos-rebuild --flake .#your-hostname'
packages = forEachSystem (pkgs: import ./nix/pkgs { inherit pkgs; });
devShells = forEachSystem (pkgs: import ./shell.nix { inherit pkgs; });
formatter = forEachSystem (pkgs: pkgs.nixpkgs-fmt);
nixosConfigurations = { nixosConfigurations = {
pixnix = nixpkgs.lib.nixosSystem { # Pixelbook converted to NixOS
pixnix = lib.nixosSystem {
modules = [ ./nix/hosts/pixnix ];
specialArgs = { inherit inputs outputs; }; specialArgs = { inherit inputs outputs; };
modules = [
# > Our main nixos configuration file <
./nix/nixos/configuration.nix
];
}; };
}; };
# Standalone home-manager configuration entrypoint # Standalone home-manager configuration entrypoint
# Available through 'home-manager --flake .#your-username@your-hostname' # Available through 'home-manager --flake .#your-username@your-hostname'
homeConfigurations = { homeConfigurations = {
"john@penguin-fw" = home-manager.lib.homeManagerConfiguration { "john@penguin-fw" = lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux; modules = [ ./nix/home/penguin-fw.nix ];
pkgs = pkgsFor.x86_64-linux;
extraSpecialArgs = { inherit inputs outputs; }; extraSpecialArgs = { inherit inputs outputs; };
modules = [
./nix/home/penguin-fw.nix
{
home = {
username = "john";
homeDirectory = "/home/john";
}; };
} "john@penguin-duet" = lib.homeManagerConfiguration {
]; modules = [ ./nix/home/penguin-duet.nix ];
}; pkgs = pkgsFor.aarch64-linux;
"john@penguin-duet" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.aarch64-linux;
extraSpecialArgs = { inherit inputs outputs; }; extraSpecialArgs = { inherit inputs outputs; };
modules = [
./nix/home/penguin-duet.nix
{
home = {
username = "john";
homeDirectory = "/home/john";
};
}
];
}; };
}; };
}; };

View file

@ -0,0 +1,25 @@
{ pkgs, ... }: {
# Common CLI apps
imports = [
./tmux.nix
./vim.nix
];
home.packages = with pkgs; [
babelfish # Lets fish speak bash
bottom # Better top
httpie # Better curl
hugo # Static site generator
jq # JSON pretty printer and manipulator
nil # Nix LSP
# nix-inspect # See which pkgs are in your Path
nixfmt # Nix formatter
packer # Hashicorp packer
powershell # Powershell
terraform # Hashicorp terraform
tldr # TLDR pages
trekscii # Cute startrek cli printer
vault # Hashicorp vault
];
}

View file

@ -0,0 +1,12 @@
{ pkgs, ... }: {
# Common GUI apps
imports = [
./vscode.nix
];
home.packages = with pkgs; [
firefox-esr
obsidian
qFlipper
];
}

View file

@ -1,12 +1,5 @@
{ outputs, pkgs, lib, ... }: { { outputs, pkgs, lib, ... }: {
nixpkgs = {
config = {
allowUnfree = true;
allowUnfreePredicate = (_: true);
};
};
programs.vscode = { programs.vscode = {
enable = true; enable = true;
enableExtensionUpdateCheck = false; enableExtensionUpdateCheck = false;

View file

@ -1,31 +1,28 @@
{ inputs, outputs, lib, config, pkgs, ... }: { { inputs, outputs, lib, config, pkgs, ... }: {
imports = [ imports = [
../lib/tmux.nix ../features/cli
../lib/vim.nix ] ++ (builtins.attrValues outputs.homeManagerModules);
];
nixpkgs.config = { nixpkgs = {
overlays = builtins.attrValues outputs.overlays;
config = {
allowUnfree = true; allowUnfree = true;
allowUnfreePredicate = (_: true); allowUnfreePredicate = (_: true);
}; };
home = {
homeDirectory = lib.mkDefault "/home/${config.home.username}";
stateVersion = lib.mkDefault "23.05";
file = {
}; };
packages = with pkgs; [ nix = {
babelfish package = lib.mkDefault pkgs.nix;
hugo settings = {
packer experimental-features = ["nix-command" "flakes" "repl-flake" ];
powershell warn-dirty = false;
terraform };
tldr };
vault
]; home = {
username = lib.mkDefault "john";
homeDirectory = lib.mkDefault "/home/${config.home.username}";
stateVersion = lib.mkDefault "23.05";
sessionVariables = { sessionVariables = {
EDITOR = "vim"; EDITOR = "vim";
@ -59,9 +56,6 @@
}; };
}; };
htop.enable = lib.mkDefault true;
jq.enable = lib.mkDefault true;
}; };

15
nix/home/lib/chromeos.nix Normal file
View file

@ -0,0 +1,15 @@
{ pkgs, lib, ... }: {
# ChromeOS integration
home.file.".config/systemd/user/cros-garcon.service.d/override.conf" = {
text = ''
[Service]
Environment="PATH=%h/.nix-profile/bin:/usr/local/sbin:/usr/local/bin:/usr/local/games:/usr/sbin:/usr/bin:/usr/games:/sbin:/bin"
Environment="XDG_DATA_DIRS=/nix/var/nix/profiles/default/share:%h/.nix-profile/share:%h/.local/share:/usr/local/share:/usr/share:/var/lib/snapd/desktop:%h/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share"
'';
};
# XDG settings
xdg.enable = true;
xdg.mime.enable = true;
}

View file

@ -1,19 +1,11 @@
{ pkgs, lib, config, ... }: { { pkgs, lib, config, ... }: {
imports = [ imports = [
./home/common.nix ./global
./lib/chromeos.nix
]; ];
nixpkgs.config = {
allowUnfree = true;
allowUnfreePredicate = (_: true);
};
# packages # packages
home.packages = with pkgs; [ home.packages = with pkgs; [
obsidian obsidian
]; ];
# XDG settings
xdg.enable = true;
xdg.mime.enable = true;
} }

View file

@ -1,24 +1,13 @@
{ pkgs, lib, config, ... }: { { inputs, outputs, lib, config, pkgs, ... }: {
imports = [ imports = [
./common.nix ./global
../lib/vscode.nix ./features/desktop
./lib/chromeos.nix
]; ];
nixpkgs.config = {
allowUnfree = true;
allowUnfreePredicate = (_: true);
};
# packages # packages
home.packages = with pkgs; [ home.packages = with pkgs; [
firefox-esr
libvirt libvirt
obsidian
qFlipper
vagrant vagrant
]; ];
# XDG settings
xdg.enable = true;
xdg.mime.enable = true;
} }

View file

@ -3,4 +3,5 @@
{ pkgs ? (import ../nixpkgs.nix) { } }: { { pkgs ? (import ../nixpkgs.nix) { } }: {
# example = pkgs.callPackage ./example { }; # example = pkgs.callPackage ./example { };
trekscii = pkgs.callPackage ./trekscii { };
} }

View file

@ -0,0 +1,23 @@
{ lib, stdenv, fetchFromGitHub }:
let
pname = "trekscii";
in
stdenv.mkDerivation {
inherit pname;
version = "unstable-2022-06-27";
src = fetchFromGitHub {
owner = "k-vernooy";
repo = pname;
rev = "8b51971c4c62f49f886d59f2c8445ce8734b00e8";
hash = "sha256-Mn3wasplwXsDCBEpHLqdh0G+SqYIirj7lKvM3VehPH0=";
};
installPhase = ''
install -Dm 0755 bin/trekscii $out/bin/trekscii
'';
meta = with lib; {
platforms = platforms.all;
};
}