initial changes to upgrade to flakes

This commit is contained in:
Salar Rahmanian 2022-08-07 22:50:23 -07:00
parent 7194bbdb83
commit cc0fd60226
4 changed files with 159 additions and 74 deletions

35
darwin-configuration.nix Normal file
View file

@ -0,0 +1,35 @@
{ pkgs, nix, nixpkgs, config, lib, ... }:
{
environment.systemPackages = with pkgs;
[
home-manager
];
fonts = {
fontDir.enable = true;
fonts = with pkgs; [
fira-code
];
};
programs.fish.enable = true;
system.stateVersion = 4;
users = {
users.salar = {
home = /Users/salar;
};
};
nix = {
nixPath = lib.mkForce [
"nixpkgs=${nixpkgs}"
];
package = pkgs.nixUnstable;
extraOptions = ''
experimental-features = nix-command flakes
'';
distributedBuilds = false;
};
services.nix-daemon.enable = true;
}

34
flake.nix Normal file
View file

@ -0,0 +1,34 @@
{
description = "Nix and home-manager configurations for Softinio's macbook";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nur.url = github:nix-community/nur;
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
darwin = {
url = "github:lnl7/nix-darwin/master";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {darwin, home-manager, nur, nixpkgs, ...}:
let
homeManagerConfFor = config: { ... }: {
nixpkgs.overlays = [ nur.overlay ];
imports = [ config ];
};
darwinSystem = darwin.lib.darwinSystem {
system = "x86_64-darwin";
modules = [
./darwin-configuration.nix
home-manager.darwinModules.home-manager {
home-manager.users.salar = homeManagerConfFor ./home.nix;
}
];
specialArgs = { inherit nixpkgs; };
};
in {
defaultPackage.x86_64-darwin = darwinSystem.system;
};
}

136
home.nix
View file

@ -8,9 +8,9 @@
nixpkgs.overlays = [ nixpkgs.overlays = [
(import ./overlays/sumneko-lua-language-server) (import ./overlays/sumneko-lua-language-server)
(import (builtins.fetchTarball { # (import (builtins.fetchTarball {
url = https://github.com/nix-community/neovim-nightly-overlay/archive/master.tar.gz; # url = https://github.com/nix-community/neovim-nightly-overlay/archive/master.tar.gz;
})) # }))
]; ];
home = { home = {
@ -21,6 +21,71 @@
EDITOR = "nvim"; EDITOR = "nvim";
VISUAL = "$EDITOR"; VISUAL = "$EDITOR";
}; };
packages = with pkgs; [
( python39.withPackages (ps: with ps; [ pip flake8 black ]) )
adoptopenjdk-bin
any-nix-shell
aspell
bloop
cabal-install
cachix
cmake
coursier
curlFull
exa
fd
ffmpeg
gitAndTools.diff-so-fancy
gnupg
go
haskellPackages.implicit-hie
hugo
lazydocker
luajit
luajitPackages.luarocks
luajitPackages.luasocket
lorri
maven
multimarkdown
mypy
ncdu
neofetch
neovim
niv
nix-index
nixfmt
nodePackages.pyright
nodePackages.typescript-language-server
nodePackages.vscode-html-languageserver-bin
nodePackages.vscode-json-languageserver
nodePackages.yaml-language-server
openssl
pandoc
patchelf
poetry
procs
rclone
readline
ripgrep
ripgrep-all
rnix-lsp
rustup
sbt
scala-cli
shellcheck
sqlite
stylua
stack
# sumneko-lua-language-server
tealdeer
tig
tokei
tree
tree-sitter
wget
xz
yq
];
}; };
programs.bat = { programs.bat = {
@ -29,7 +94,6 @@
programs.direnv = { programs.direnv = {
enable = true; enable = true;
enableFishIntegration = true;
nix-direnv.enable = true; nix-direnv.enable = true;
}; };
@ -218,7 +282,7 @@
v="nvim"; v="nvim";
tabninecfg="vc /Users/salar/Library/Preferences/TabNine/TabNine.toml"; tabninecfg="vc /Users/salar/Library/Preferences/TabNine/TabNine.toml";
sshfre1="ssh salar@fre1.softinio.net"; sshfre1="ssh salar@fre1.softinio.net";
sshfre2="ssh salar@fre2.softinio.net"; sshfre2="ssh -p 2022 salar@fre2.softinio.net";
}; };
}; };
@ -231,66 +295,4 @@
# Neovim Configuration # Neovim Configuration
xdg.configFile."nvim/lua/salargalaxyline.lua".source = programs/neovim/settings/salargalaxyline.lua; xdg.configFile."nvim/lua/salargalaxyline.lua".source = programs/neovim/settings/salargalaxyline.lua;
xdg.configFile."nvim/init.lua".source = programs/neovim/init.lua; xdg.configFile."nvim/init.lua".source = programs/neovim/init.lua;
home.packages = [
pkgs.adoptopenjdk-bin
pkgs.any-nix-shell
pkgs.aspell
pkgs.bloop
pkgs.cmake
pkgs.coursier
pkgs.curlFull
pkgs.direnv
pkgs.dust
pkgs.exa
pkgs.fd
pkgs.ffmpeg
pkgs.gitAndTools.diff-so-fancy
pkgs.global
pkgs.gnupg
pkgs.go
pkgs.hugo
pkgs.jansson
pkgs.luajit
pkgs.luajitPackages.luarocks
pkgs.luajitPackages.luasocket
pkgs.maven
pkgs.multimarkdown
pkgs.ncdu
pkgs.neofetch
pkgs.neovim
pkgs.niv
pkgs.nixFlakes
pkgs.nixfmt
pkgs.nodePackages.pyright
pkgs.nodePackages.typescript-language-server
pkgs.nodePackages.vscode-html-languageserver-bin
pkgs.nodePackages.vscode-json-languageserver
pkgs.nodePackages.yaml-language-server
pkgs.openssl
pkgs.pandoc
pkgs.prettyping
pkgs.procs
pkgs.python3Full
pkgs.python39Packages.debugpy
pkgs.readline
pkgs.ripgrep
pkgs.ripgrep-all
pkgs.rnix-lsp
pkgs.rustup
pkgs.sbt
pkgs.scala-cli
pkgs.shellcheck
pkgs.stylua
pkgs.sumneko-lua-language-server
pkgs.tealdeer
pkgs.tig
pkgs.tokei
pkgs.tree
pkgs.tree-sitter
pkgs.universal-ctags
pkgs.wget
pkgs.xz
pkgs.yq
];
} }

View file

@ -7,6 +7,7 @@ let
pager = "diff-so-fancy | less --tabs=4 -RFX"; pager = "diff-so-fancy | less --tabs=4 -RFX";
}; };
init.defaultBranch = "main"; init.defaultBranch = "main";
merge.conflictStyle = "diff3";
merge.tool = "intellij"; merge.tool = "intellij";
mergetool = { mergetool = {
cmd = "idea merge \"$LOCAL\" \"$REMOTE\" \"$BASE\" \"$MERGED\""; cmd = "idea merge \"$LOCAL\" \"$REMOTE\" \"$BASE\" \"$MERGED\"";
@ -23,20 +24,24 @@ let
insteadOf = "https://github.com/"; insteadOf = "https://github.com/";
}; };
}; };
fetch.prune = true;
pull = { pull = {
rebase = true; rebase = true;
}; };
}; };
in myAliases = {
{ ci = "commit";
programs.git = { co = "checkout";
enable = true; main = "checkout main";
userEmail = "code@softinio.com"; master = "checkout master";
userName = "Salar Rahmanian"; };
ignores = [ myIgnores = [
"*~" "*~"
".DS_Store" ".DS_Store"
"*.bloop" "*.bloop"
".direnv/"
".idea/"
".mypy_cache"
"*.metals" "*.metals"
"*.metals.sbt" "*.metals.sbt"
"*metals.sbt" "*metals.sbt"
@ -47,7 +52,16 @@ in
"*.idea" "*.idea"
"*.vscode" "*.vscode"
"*.python-version" "*.python-version"
"result"
]; ];
in
{
programs.git = {
enable = true;
userEmail = "code@softinio.com";
userName = "Salar Rahmanian";
aliases = myAliases;
ignores = myIgnores;
extraConfig = gitConfig; extraConfig = gitConfig;
}; };
} }