1
Fork 0

feat: initial config

This commit is contained in:
Matei Adriel 2020-04-08 19:36:58 +03:00
commit df5ce78519
16 changed files with 412 additions and 0 deletions

View file

@ -0,0 +1 @@
{ ... }: { imports = [ ./misc.nix ./locale.nix ./git ]; }

View file

@ -0,0 +1,39 @@
# Most of these are copied from: https://github.com/Brettm12345/nixos-config/blob/1400c71bce/modules/applications/git/aliases.nix
let
git = text: ''"!git ${text}"'';
f = text: ''"!f(){ ${text} };f"'';
in {
# Unstage all changes
unstage = "reset HEAD --";
# Ammend to the last commit
amend = "commit --amend -C HEAD";
# List branches sorted by last modified
b = git
"for-each-ref --sort='-authordate' --format='%(authordate)%09%(objectname:short)%09%(refname)' refs/heads | sed -e 's-refs/heads/--'";
# Test merge for conflicts before merging
mergetest = f ''
git merge --no-commit --no-ff "$1"; git merge --abort; echo "Merge aborted";'';
# Get description of current repo
description = git
''config --get "branch.$(git rev-parse --abbrev-ref HEAD).description"'';
# Show authors
authors = ''
"!f() { git log --no-merges --pretty='format:%<(26)%an <%ae>' --author "$*" | sort | uniq# }# f"'';
a = "add";
cm = "commit --message";
caa = "commit --ammend";
cl = "clone";
co = "checkout";
col = "checkout @{-1}";
cob = "checkout -b";
st = "stash";
pop = "stash pop";
t = "tag";
}

View file

@ -0,0 +1,20 @@
{ pkgs, ... }: {
home-manager.users.adrielus = {
home.packages = with pkgs.gitAndTools; [ hub ];
programs.git = {
enable = true;
userName = "Matei Adriel";
userEmail = "rafaeladriel11@gmail.com";
aliases = import ./aliases.nix;
extraConfig = {
github.user = "Mateiadrielrafael";
hub.protocol = "ssh";
rebase.autoStash = true;
};
};
};
}

View file

@ -0,0 +1,9 @@
{ ... }: {
i18n = {
consoleFont = "Lat2-Terminus16";
consoleKeyMap = "us";
defaultLocale = "en_US.UTF-8";
};
time.timeZone = "Europe/Bucharest";
}

View file

@ -0,0 +1,11 @@
{ pkgs, ... }: {
environment.systemPackages = with pkgs; [
# Tool to allow hashing passwords from the cmd
mkpasswd
vscodium
google-chrome
discord
git
];
}

10
modules/default.nix Normal file
View file

@ -0,0 +1,10 @@
{ ... }: {
imports = [
./dev
./applications
./network.nix
./xserver.nix
./users.nix
./overlay.nix
];
}

1
modules/dev/default.nix Normal file
View file

@ -0,0 +1 @@
{ ... }: { imports = [ ./nix.nix ]; }

3
modules/dev/nix.nix Normal file
View file

@ -0,0 +1,3 @@
{ pkgs, ... }: {
environment.systemPackages = with pkgs; [ nixfmt niv cached-nix-shell ];
}

13
modules/network.nix Normal file
View file

@ -0,0 +1,13 @@
{ ... }: {
networking = {
networkmanager.enable = true;
hostName = "nixos";
# The global useDHCP flag is deprecated, therefore explicitly set to false here.
# Per-interface useDHCP will be mandatory in the future, so this generated config
# replicates the default behaviour.
useDHCP = false;
interfaces.enp1s0.useDHCP = true;
interfaces.wlp0s20f3.useDHCP = true;
};
}

28
modules/overlay.nix Normal file
View file

@ -0,0 +1,28 @@
{ ... }:
let imports = import ../nix/sources.nix;
in {
nixpkgs.overlays = [
(self: super:
with self; rec {
inherit imports;
cached-nix-shell = callPackage imports.cached-nix-shell { };
inherit (import imports.niv { }) niv;
inherit (import imports.all-hies { }) all-hies;
})
];
# allow packages with unfree licenses
nixpkgs.config.allowUnfree = true;
nix = {
trustedUsers = [ "root" "adrielus" "@wheel" ];
autoOptimiseStore = true;
gc.automatic = true;
optimise.automatic = true;
binaryCaches = [ "https://cache.nixos.org" "https://all-hies.cachix.org" ];
binaryCachePublicKeys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"all-hies.cachix.org-1:JjrzAOEUsD9ZMt8fdFbzo3jNAyEWlPAwdVuHw4RD43k="
];
};
}

11
modules/users.nix Normal file
View file

@ -0,0 +1,11 @@
{ ... }: {
users = {
mutableUsers = false;
users.adrielus = {
isNormalUser = true;
extraGroups = [ "wheel" "networkmanager" ];
hashedPassword =
"$6$5NX9cuUbX$yjiBbroplRLanLfJ5wNjjsd9rSvN81BCNEnuF2DUgfMa/TPYdl5PUYcWF52VxNbisDPsR2Q5EhgNrgALatpT3/";
};
};
}

23
modules/xserver.nix Normal file
View file

@ -0,0 +1,23 @@
{ ... }: {
services.xserver = {
# Enable the X11 windowing system.
enable = true;
layout = "us";
xkbOptions = "eurosign:e";
# Enable the KDE Desktop Environment.
displayManager.sddm.enable = true;
desktopManager.plasma5.enable = true;
libinput = {
# Enable touchpad support.
enable = true;
naturalScrolling = true;
accelSpeed = "2.5";
# who thought letting this be true by default was a good idea
tappingDragLock = false;
};
};
}