Skip to content

Commit

Permalink
Extract Nix and home-manager tips from Nix files
Browse files Browse the repository at this point in the history
  • Loading branch information
kachick committed Aug 8, 2023
1 parent 06850d6 commit f7438d9
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 32 deletions.
36 changes: 36 additions & 0 deletions home-manager/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# FAQ

Also read <https://github.com/kachick/dotfiles/wiki/Nix-and-home-manager>

## How to get sha256 without `lib.fakeSha256`?

```bash
nix-prefetch-git --url https://github.com/oh-my-fish/plugin-foreign-env.git --rev 3ee95536106c11073d6ff466c1681cde31001383 --quiet | jq .hash
```

## How to make executable? `.text =` makes a sym, that links to non executable file

```nix
home.file."path".executable = true;
```

Read <https://github.com/nix-community/home-manager/blob/15043a65915bcc16ad207d65b202659e4988066b/modules/xsession.nix#L195C1-L197> as an example

## How to know and get the paths inside a pkg?

`nix path-info` is a way, installing iTerm2 shell integration used it. Access /nix/store~ path, and `ls` helps you.

## How to use edge dependencies only in some packages?

```nix
let
pkgsUnstable = import
(fetchTarball
"https://releases.nixos.org/nixpkgs/nixpkgs-23.11pre509044.3acb5c4264c4/nixexprs.tar.xz")
{ };
in
```

## I cannot find dot files in the macOS Finder

<https://apple.stackexchange.com/a/250646>, consider to use [nix-darwin](https://github.com/LnL7/nix-darwin/blob/16c07487ac9bc59f58b121d13160c67befa3342e/modules/system/defaults/finder.nix#L8-L14)
6 changes: 0 additions & 6 deletions home-manager/darwin.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
{ pkgs, lib, ... }:

# FAQ
#
# A. can not found dot files in macOS finder
# Q. https://apple.stackexchange.com/a/250646, consider to use nix-darwin
# https://github.com/LnL7/nix-darwin/blob/16c07487ac9bc59f58b121d13160c67befa3342e/modules/system/defaults/finder.nix#L8-L14

# https://github.com/nix-community/home-manager/issues/414#issuecomment-427163925
lib.mkMerge [
(lib.mkIf pkgs.stdenv.isDarwin {
Expand Down
2 changes: 1 addition & 1 deletion home-manager/fish.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ pkgs, lib, ... }:
{ pkgs, ... }:

{
programs.starship.enableFishIntegration = true;
Expand Down
5 changes: 0 additions & 5 deletions home-manager/home.nix
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
{ config, pkgs, lib, ... }:

# FAQ
#
# A. How to get sha256 without `lib.fakeSha256`?
# Q. `nix-prefetch-git --url https://github.com/oh-my-fish/plugin-foreign-env.git --rev 3ee95536106c11073d6ff466c1681cde31001383 --quiet | jq .hash`

{
imports = [
./packages.nix
Expand Down
5 changes: 0 additions & 5 deletions home-manager/homemade.nix
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
{ pkgs, lib, ... }:

# FAQ
#
# A. How to make executable? .text= makes syms, that links to non executable file
# Q. https://github.com/nix-community/home-manager/blob/15043a65915bcc16ad207d65b202659e4988066b/modules/xsession.nix#L195C1-L197

# - Tiny tools by me, they may be rewritten with another language.
{
# - Keep *.bash in shellscript naming in this repo for maintainability, the extname should be trimmed in the symlinks
Expand Down
15 changes: 0 additions & 15 deletions home-manager/packages.nix
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
{ pkgs, ... }:

# If I need the some of edge dependencies, this is the how to point unstable
#
# let
# pkgsUnstable = import
# (fetchTarball
# "https://releases.nixos.org/nixpkgs/nixpkgs-23.11pre509044.3acb5c4264c4/nixexprs.tar.xz")
# { };
# in

# FAQ
#
# A. How to know and get the paths inside a pkg?
# Q. `nix path-info` is a way, installing iTerm2 shell integration used it. Access /nix/store~ path, and `ls` helps you.


{
home.packages = with pkgs; [
# Use `bashInteractive`, don't `bash` - https://github.com/NixOS/nixpkgs/issues/29960, https://github.com/NixOS/nix/issues/730
Expand Down

0 comments on commit f7438d9

Please sign in to comment.