• 2 Posts
  • 163 Comments
Joined 1 year ago
cake
Cake day: August 10th, 2023

help-circle







  • oh my goodness, I feel so heard right now, that’s exactly as I always felt, I’m glad I’m not the only human obsessing over these things (well, not meaning that I enjoy your struggle lol).

    I also don’t want to be too personally identifiable

    I think you could do like some other accounts I’ve seen doing, merging their name and surname in some peculiar way, I did the same, but just for having a sort of unique, easy to use handle, I still keep my actual git username as my real one because I want to be identified with it. You on the other hand could do that and also use the same nickname as the git username. Another system I’ve always liked is to use this neat page on Perchance that generates an adjective-animal couple and they are so convenient for making up random names.
    If you go all out and keep one identity and in the clear too, big respect, I don’t do it because I never want to end up in a moment where I wonder “what I’m going to do is a bit in a gray area of acceptable, should I make a new account for this?” as that’s going to break all the continuity that is useful to stay connected with the community. When sioling the two identities, I can do everything with much more peace of mind.

    I laughed at “adult friendly” but that’s seriously apt.

    Very happy that the humor came across 😆
    And seeing how exotic/esoteric nix looks to older people, yes apt is way more adult friendly than nix









  • I’ve analyzed the script a bit (…ok for more than 2 hours + 2 of refactoring), because the first time I absolutely didn’t understand it, now I’ve got it, but still, I won’t ever understand, why make the syntax so confusing?
    My system definition shouldn’t be a codegolfing competition (•ˋ _ ˊ•)

    TL;DR: I liked your script as a challenge to learn even more and I’m glad I did! Now I know a quite a bit more about the functions that Nix provides and how to use them, not a lot, but better than my previous almost 0, so thank you!

    Anyways, here's the unmangled thing explained for anyone else who's interested (wrote for plain evaluation, it's interesting what each part outputs):
    {
      /*
      builtins.unsafeGetAttrPos "_" { _ = null; }
    
      yields:
      {
        column = 46;
        file = "/path/to/this/slightly-unholy-file-finder.nix";
        line = 14;
      };
    
      you want to get the value of the name (which is the "key" in this key-value list) "file"
      */
      filePath = (builtins.unsafeGetAttrPos "_" { _ = null; }).file; # absolute path to current file
      directoryEntries = builtins.readDir ./.;
    
      entryNames = map
        (node: "./${node}")
        (
          # get name of files
          builtins.attrNames
            (
              /**
              use the function from before to remove this file right here
              from the set (NOT a list) of nodes found by readDir
              (may be files, dirs, etc.)
              
              Why?
              Because we start reading from the path ./
              which is where this file is located, of course
              */
              builtins.removeAttrs
                (builtins.readDir ./.)
                [
                  /*
                  get the current file name with some built-in, 
                  either un- or poorly documented function black magic fuckery
                  (I really wasn't able to find any proper documentation on this function)
                  */
                  (baseNameOf (builtins.unsafeGetAttrPos "_" { _ = null; }).file)
                ]
            )
        );
    }
    
    

    run it with:

    nix eval -f ./slightly-unholy-file-finder.nix
    

    There were multiple problems with this solution as I tried it:

    1. The missing baseName on line 39 which was needed to actually filter out the file path of the script that is being ran, because the paths I got out of readDir were relative (just for me? Did I change something in my environment? I’m not usre, the docs aren’t very clear)
    2. It doesn’t filter out files that are not .nix files
    3. It doesn’t filter out directories (may be intentional though, I personally don’t think that’s a great idea as far as I got)

    I’ll post later my own further improved solution starting from my own (tbh, by now more like our) script.