Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lib/devos/devosSystem.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ lib.nixosSystem (args // {
# avoid unwanted systemd service startups
# all strings in disabledModules get appended to modulesPath
# so convert each to list which can be coerced to string
disabledModules = map (x: [ x ])
(lib.remove modules.core suites.allProfiles);
disabledModules = map (x: [ x ]) suites.allProfiles;

nix.registry = lib.mapAttrs (n: v: { flake = v; }) inputs;

Expand Down
34 changes: 32 additions & 2 deletions lib/devos/mkHosts.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ let
];

modules = {
core = "${self}/profiles/core";
core = "${self}/modules/core";

modOverrides = { config, overrideModulesPath, ... }:
let
inherit (overrides) modules disabledModules;
Expand All @@ -24,7 +25,7 @@ let
modules;
};

global = { config, ... }: {
global = { config, pkgs, ... }: {
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
Expand All @@ -33,8 +34,32 @@ let
sharedModules = extern.userModules ++ (builtins.attrValues self.homeModules);
};

devos.defaults = {
shell = lib.mkDefault true;
fonts = lib.mkDefault true;
packages = lib.mkDefault true;
};

users.mutableUsers = false;

services.earlyoom.enable = true;
hardware.enableRedistributableFirmware = lib.mkDefault true;

nix.package = pkgs.nixFlakes;

nix = {
autoOptimiseStore = true;
gc.automatic = true;
optimise.automatic = true;

useSandbox = true;

allowedUsers = [ "@wheel" ];
trustedUsers = [ "root" "@wheel" ];
};

nix.systemFeatures = [ "nixos-test" "benchmark" "big-parallel" "kvm" ];

nix.nixPath = [
"nixpkgs=${nixos}"
"nixos-config=${self}/compat/nixos"
Expand All @@ -53,6 +78,11 @@ let
experimental-features = ${lib.concatStringsSep " "
experimentalFeatures
}
min-free = 536870912
keep-outputs = true
keep-derivations = true
fallback = true

'';

system.configurationRevision = lib.mkIf (self ? rev) self.rev;
Expand Down
133 changes: 133 additions & 0 deletions modules/core/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.devos.defaults;
in
{
options = {
devos.defaults = {
shell = mkEnableOption "sane shell aliases and prompt";
fonts = mkEnableOption "and install useful fonts";
packages = mkEnableOption "useful packages in the environment";
};
};

config = mkMerge [
(mkIf cfg.packages {
environment.systemPackages = with pkgs; [
binutils
coreutils
curl
deploy-rs
direnv
dnsutils
dosfstools
fd
git
gotop
gptfdisk
iputils
jq
manix
moreutils
nix-index
nmap
ripgrep
skim
tealdeer
utillinux
whois
];
})
(mkIf cfg.shell {
environment = {
shellInit = ''
export STARSHIP_CONFIG=${
pkgs.writeText "starship.toml"
(fileContents ./starship.toml)
}
'';


shellAliases =
let ifSudo = lib.mkIf config.security.sudo.enable;
in
{
# quick cd
".." = "cd ..";
"..." = "cd ../..";
"...." = "cd ../../..";
"....." = "cd ../../../..";

# git
g = "git";

# grep
grep = "rg";
gi = "grep -i";

# internet ip
myip = "dig +short myip.opendns.com @208.67.222.222 2>&1";

# nix
n = "nix";
np = "n profile";
ni = "np install";
nr = "np remove";
ns = "n search --no-update-lock-file";
nf = "n flake";
nepl = "n repl '<nixpkgs>'";
srch = "ns nixos";
orch = "ns override";
nrb = ifSudo "sudo nixos-rebuild";
mn = ''
manix "" | grep '^# ' | sed 's/^# \(.*\) (.*/\1/;s/ (.*//;s/^# //' | sk --preview="manix '{}'" | xargs manix
'';

# fix nixos-option
nixos-option = "nixos-option -I nixpkgs=${toString ../../compat}";

# sudo
s = ifSudo "sudo -E ";
si = ifSudo "sudo -i";
se = ifSudo "sudoedit";

# top
top = "gotop";

# systemd
ctl = "systemctl";
stl = ifSudo "s systemctl";
utl = "systemctl --user";
ut = "systemctl --user start";
un = "systemctl --user stop";
up = ifSudo "s systemctl start";
dn = ifSudo "s systemctl stop";
jtl = "journalctl";

};
};
programs.bash = {
promptInit = ''
eval "$(${pkgs.starship}/bin/starship init bash)"
'';
interactiveShellInit = ''
eval "$(${pkgs.direnv}/bin/direnv hook bash)"
'';
};
})
(mkIf cfg.fonts {
fonts = {
fonts = with pkgs; [ powerline-fonts dejavu_fonts ];

fontconfig.defaultFonts = {

monospace = [ "DejaVu Sans Mono for Powerline" ];

sansSerif = [ "DejaVu Sans" ];

};
};
})
];
}
File renamed without changes.
150 changes: 0 additions & 150 deletions profiles/core/default.nix

This file was deleted.