In creating a scriptSig, how do I sign the hash of a raw transaction? I have created a raw transaction, added the hash code, and Double-sha256 this result.  Now I should sign this hash with the private key, which would give me the DER encoded signature, but I'm not clear on what exactly I should be doing.  How do I SIGN this hash with the private key?  What exactly would I be doing?  I am not using any crypto library, except for SHA256, and I have implemented secp256k1 my self, so I guess in relation to that, what should I be doing with the private key and the hash?  I am specifically aimed at step 15.  If I were to guess, this and this are essentially my answer, unless I am mistaken, and if I am, I would like to know why.  Otherwise, the caveat with those answers is the introduction of a random nonce.  Why could I not just have the private key = "k" (since you shouldn't reuse addresses anyway, right?), calculate "s", and concatenate "r" and "s"?  Or is this how it IS done?
It is not the sha256(sha256(tx_bytes)) that needs to be signed. You need to follow the specific algorithm defined inside of Bitcoin core to produce a proper digital signature. Here is where the signature encoding algorithm is defined. Notice, that this algorithm changes slightly based on the hash type you provide. This allows us functionality to include (or prevent inclusion) of extra inputs/outputs on a transaction.