Compare commits

...

8 commits

21 changed files with 381 additions and 160 deletions

View file

@ -1,5 +1,58 @@
{ {
"nodes": { "nodes": {
"firefox-addons": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"dir": "pkgs/firefox-addons",
"lastModified": 1690516944,
"narHash": "sha256-MfrIP2efvDhGZHhkgcMwMygqK2USpwiO8I9EEFPYn/c=",
"owner": "rycee",
"repo": "nur-expressions",
"rev": "8c2d969a614c21e8d6f2fade01e31bd89dcb4d1d",
"type": "gitlab"
},
"original": {
"dir": "pkgs/firefox-addons",
"owner": "rycee",
"repo": "nur-expressions",
"type": "gitlab"
}
},
"flake-utils": {
"locked": {
"lastModified": 1629284811,
"narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c5d161cc0af116a2e17f54316f0bf43f0819785c",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"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 +108,8 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"firefox-addons": "firefox-addons",
"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,60 @@
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";
# Firefox add-ons
firefox-addons = {
url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons";
inputs.nixpkgs.follows = "nixpkgs";
};
}; };
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";
}; };
} "john@pixnix" = lib.homeManagerConfiguration {
]; modules = [ ./nix/home/pixnix.nix ];
pkgs = pkgsFor.x86_64-linux;
extraSpecialArgs = { inherit inputs outputs; };
}; };
}; };
}; };

View file

@ -1,69 +0,0 @@
{ inputs, outputs, lib, config, pkgs, ... }: {
imports = [
../lib/tmux.nix
../lib/vim.nix
];
nixpkgs.config = {
allowUnfree = true;
allowUnfreePredicate = (_: true);
};
home = {
homeDirectory = lib.mkDefault "/home/${config.home.username}";
stateVersion = lib.mkDefault "23.05";
file = {
};
packages = with pkgs; [
babelfish
hugo
packer
powershell
terraform
tldr
vault
];
sessionVariables = {
EDITOR = "vim";
};
};
programs = {
home-manager.enable = true;
direnv = {
enable = lib.mkDefault true;
nix-direnv.enable = true;
};
fish = {
enable = true;
shellInit = "source ${config.home.homeDirectory}/.nix-profile/etc/profile.d/nix.fish";
functions = {
switch-home = "home-manager switch -b backup --flake ${config.home.homeDirectory}/.dotfiles#$USER@$(hostname -s)";
};
};
git = {
enable = lib.mkDefault true;
delta.enable = true;
userEmail = lib.mkDefault "john@bowdre.net";
userName = lib.mkDefault "John Bowdre";
extraConfig = {
init.defaultBranch = "main";
pull.rebase = false;
};
};
htop.enable = lib.mkDefault true;
jq.enable = lib.mkDefault true;
};
targets.genericLinux.enable = true;
}

View file

@ -0,0 +1,28 @@
{ pkgs, ... }: {
# Common CLI apps
imports = [
./direnv.nix
./git.nix
./fish.nix
./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,6 @@
{
programs.direnv = {
enable = true;
nix-direnv.enable = true;
};
}

View file

@ -0,0 +1,80 @@
{ pkgs, lib, config, ... }:
let
inherit (lib) mkIf;
hasPackage = pname: lib.any (p: p ? pname && p.name == pname) config.home.packages;
hasExa = hasPackage "exa";
in
{
programs.fish = {
enable = true;
shellAbbrs = rec {
jqless = "jq -C | less -r";
ls = mkIf hasExa "exa";
vi = "vim";
v = "vim";
};
shellAliases = {
};
functions = {
# Disable greeting
fish_greeting = "";
# Rebuild home-manager
switch-home = "home-manager switch -b backup --flake ${config.home.homeDirectory}/.dotfiles#$USER@$(hostname -s)";
};
shellInit = "source ${config.home.homeDirectory}/.nix-profile/etc/profile.d/nix.fish";
interactiveShellInit =
# Open command buffer in vim when alt+e is pressed
''
bind \ee edit_command_buffer
'' +
# Use vim bindings and cursors
''
fish_vi_key_bindings
set fish_cursor_default block blink
set fish_cursor_insert line blink
set fish_cursor_replace_one underscore blink
set fish_cursor_visual block
'' +
# Restore ctrl+f to accept suggestions
''
bind -M insert \cf forward-char
bind -M default \cf forward-char
bind -M visual \cf forward-char
'' +
# Use terminal colors
''
set -U fish_color_autosuggestion brblack
set -U fish_color_cancel -r
set -U fish_color_command brgreen
set -U fish_color_comment brmagenta
set -U fish_color_cwd green
set -U fish_color_cwd_root red
set -U fish_color_end brmagenta
set -U fish_color_error brred
set -U fish_color_escape brcyan
set -U fish_color_history_current --bold
set -U fish_color_host normal
set -U fish_color_match --background=brblue
set -U fish_color_normal normal
set -U fish_color_operator cyan
set -U fish_color_param brblue
set -U fish_color_quote yellow
set -U fish_color_redirection bryellow
set -U fish_color_search_match 'bryellow' '--background=brblack'
set -U fish_color_selection 'white' '--bold' '--background=brblack'
set -U fish_color_status red
set -U fish_color_user brgreen
set -U fish_color_valid_path --underline
set -U fish_pager_color_completion normal
set -U fish_pager_color_description yellow
set -U fish_pager_color_prefix 'white' '--bold' '--underline'
set -U fish_pager_color_progress 'brwhite' '--background=cyan'
'';
};
}

View file

@ -0,0 +1,16 @@
{ lib, ... }: {
programs.git = {
enable = lib.mkDefault true;
delta.enable = true;
aliases = {
graph = "log --decorate --oneline --graph";
fast-forward = "merge --ff-only";
};
userEmail = lib.mkDefault "john@bowdre.net";
userName = lib.mkDefault "John Bowdre";
extraConfig = {
init.defaultBranch = "main";
pull.rebase = false;
};
};
}

View file

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

View file

@ -0,0 +1,48 @@
{ pkgs, lib, inputs, ... }:
let
addons = inputs.firefox-addons.packages.${pkgs.system};
in
{
programs.firefox = {
enable = true;
profiles.john = {
bookmarks = { };
# extensions = with addons; [
# bitwarden-password-manager
# privacy-badger17
# raindropio
# ];
bookmarks = { };
settings = {
"app.update.auto" = false;
"browser.disableResetPrompt" = true;
"browser.download.panel.shown" = true;
"browser.download.useDownloadDir" = true;
"browser.newtabpage.activity-stream.showSponsoredTopSites" = false;
"browser.shell.checkDefaultBrowser" = false;
"browser.shell.defaultBrowserCheckCount" = 1;
"browser.startup.homepage" = "https://kagi.com/";
"dom.security.https_only_mode" = true;
"extensions.pocket.enabled" = false;
"identity.fxaccounts.enabled" = true;
"privacy.trackingprotection.enabled" = true;
"signon.rememberSignons" = false;
};
};
};
home = {
sessionVariables = {
# https://github.com/NixOS/nixpkgs/issues/238025
TZ = "/etc/localtime";
};
};
xdg.mimeApps.defaultApplications = {
"text/html" = [ "firefox.desktop" ];
"text/xml" = [ "firefox.desktop" ];
"x-scheme-handler/http" = [ "firefox.desktop" ];
"x-scheme-handler/https" = [ "firefox.desktop" ];
};
}

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

@ -0,0 +1,38 @@
{ inputs, outputs, lib, config, pkgs, ... }: {
imports = [
../features/cli
] ++ (builtins.attrValues outputs.homeManagerModules);
nixpkgs = {
overlays = builtins.attrValues outputs.overlays;
config = {
allowUnfree = true;
allowUnfreePredicate = (_: true);
};
};
nix = {
package = lib.mkDefault pkgs.nix;
settings = {
experimental-features = ["nix-command" "flakes" "repl-flake" ];
warn-dirty = false;
};
};
home = {
username = lib.mkDefault "john";
homeDirectory = lib.mkDefault "/home/${config.home.username}";
stateVersion = lib.mkDefault "23.05";
sessionVariables = {
EDITOR = "vim";
};
};
programs = {
home-manager.enable = true;
};
targets.genericLinux.enable = 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,20 +1,12 @@
{ pkgs, lib, config, ... }: { { pkgs, lib, config, ... }: {
imports = [ imports = [
./common.nix ./global
../lib/vscode.nix ./lib/chromeos.nix
./features/desktop/vscode.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;
} }

12
nix/home/pixnix.nix Normal file
View file

@ -0,0 +1,12 @@
{ inputs, outputs, lib, config, pkgs, ... }: {
imports = [
./global
./features/desktop
];
# packages
home.packages = with pkgs; [
libvirt
vagrant
];
}

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;
};
}